This question evaluates competency in array manipulation, handling of sorted data, search techniques and algorithmic complexity analysis, focusing on skills such as leveraging sorted order and reasoning about time and space trade-offs.
Implement solutions for the following two array problems:
[-7, -3, 0, 2, 5]
[0, 4, 9, 25, 49]
[-1, -1]
.
Example:
nums = [1, 2, 2, 2, 3, 5]
,
target = 2
[1, 3]
Discuss the expected time and space complexity for each problem.