simplest two pointer, explained
Intuitionwe need to find the sum of a negative number and a positive number to be 0we sort our array, initialize left as zero and right as final indexwe basical
# Intuition
we need to find the sum of a negative number and a positive number to be 0

we sort our array, initialize left as zero and right as final index

we basically divide the array into negative and positive half, 
left pointer starts from the most negative element to the least negative
right pointer starts from the most positive element to the least positive

we run our while loop as long as left pointer points to a negative number and right pointer to a positive number

we define a sum, which is sum of negative and positive number

i) if sum is positive, that means our positive number is too big, so we check the next most positive number
ii) if sum is negative, that means our negative number is too negative, so we check the next most negative number
iii) if sum is 0, we have our answer

if we did not get an answer we return -1;

# Complexity
- Time complexity:
O(nlogn)
- Space complexity:
O(1)
# Code
```cpp []
class Solution {
public:
    int findMaxK(vector<int>& nums) 
    {
        sort(nums.begin(),nums.end());
        int left = 0,right=nums.size()-1;
        while(nums[left]<0 && nums[right]>0)
        {
            int sum = nums[left] + nums[right];
            if(sum>0)
                right--;
            if(sum<0)
                left++;
            if(sum==0)
                return nums[right];
        }
        return -1;
    }
};
```
['C++']