- Type: Two pointers
- Approach:
- Set two pointers as 0 and max value, if the value of function equal to z, add 2 pointers to the result; if the value of function larger than z, shrink the value of bigger pointer; otherwise, make the value of smaller pointer larger.
- Complexity:
- Time: O(n)
- Space: O(n)