Binary Search O(NlogN) Solution
cpp\nclass Solution {\npublic:\n    int findMaxK(vector<int> &nums) {\n        int n = nums.size();\n        sort(nums.begin(), nums.end());\n        for (int i
```cpp\nclass Solution {\npublic:\n    int findMaxK(vector<int> &nums) {\n        int n = nums.size();\n        sort(nums.begin(), nums.end());\n        for (int i = n - 1; i >= 0; i--) {\n            if (nums[i] < 0) return -1;\n            if (binary_search(nums.begin(), nums.end(), -nums[i])) {\n                return nums[i];\n            }\n        }\n        return -1;\n    }\n};\n```\n\nTime Complexity: **O(N * logN)**\nSpace Complexity: **O(1)**\n
['C', 'Binary Tree', 'C++']