💯JAVA Solution Explained in HINDI (4 Approaches)
https://youtu.be/6fkCZNSwC6s\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote 
https://youtu.be/6fkCZNSwC6s\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote the solution if you liked it.\n\n# Subscribe link:- [ReelCoding](https://www.youtube.com/@reelcoding?sub_confirmation=1)\n\nSubscribe Goal:- 400\nCurrent Subscriber:- 351\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int findMaxK(int[] nums) {\n        boolean[] vis = new boolean[2001];\n        int ans = -1;\n        \n        for (int el : nums) {\n            if (vis[-el + 1000]) ans = Math.max(ans, Math.abs(el));\n            vis[el + 1000] = true;\n        }\n        \n        return ans; \n\n    }\n}\n```\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n```\nclass Solution {\n    public int findMaxK(int[] nums) {\n        HashSet<Integer> s = new HashSet<>();\n        int ans = -1;\n        \n        for (int el : nums) {\n            if (s.contains(-el)) ans = Math.max(ans, Math.abs(el));\n            s.add(el);\n        }\n        \n        return ans; \n    }\n}\n```\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n```\nclass Solution {\n    public int findMaxK(int[] nums) {\n       HashSet<Integer> neg = new HashSet<>();\n\n        for (int el : nums) {\n            if (el < 0) neg.add(el);\n        }\n\n        int ans = -1;\n        for (int el : nums) {\n            if (el > 0 && el > ans && neg.contains(-el)) {\n                ans = el;\n            }\n        }\n        \n        return ans;   \n    }\n}\n```\n# Complexity\n- Time complexity: O(nlogn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n```\nclass Solution {\n    public int findMaxK(int[] nums) {\n        Arrays.sort(nums);\n\n        int i = 0, j = nums.length - 1;\n        while (i < j) {\n            if (-nums[i] == nums[j]) return nums[j];\n            else if (-nums[i] > nums[j]) i++;\n            else j--;\n        }\n\n        return -1;\n    }\n}\n```
['Java']