Two pointer Approach | No extra space
Approach\n- Sort input array so that all negatives are in begin and positives are in end\n- Keep two pointers one for positive and one for negative integers\n- 
# Approach\n- Sort input array so that all negatives are in begin and positives are in end\n- Keep two pointers one for positive and one for negative integers\n- Move the pointer af number with absolute larger value to next one if they are equal return the value \n\n# Complexity\n- Time complexity:\nO(nlogn)\n- Space complexity:\nConstant space\n# Code\n```\nclass Solution {\npublic:\n    int findMaxK(vector<int>& a) {\n        sort(a.begin(), a.end());\n        int s =0,e=a.size()-1;\n        while(s<e&&a[s]<0&&a[e]>0) {\n            if(a[s]==a[e]*-1)return a[e];\n            if(a[s]*-1>a[e])s++;\n            else e--;\n        }\n        return -1;\n    }\n};\n```
['C++']