100% - O(N) - O(1) Java✅
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# Co
# 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        int[] freq = new int[1001];\n\n        for(int num : nums){\n            if(num<0) freq[num*-1]++;\n        };\n\n        int max = -1;\n\n        for(int num : nums){\n            if(num > 0){\n                if(freq[num]!=0){\n                    if(num > max) max = num;\n                }\n            }\n        }\n\n        return max;\n    }\n}\n```\n![upvote.jpeg](https://assets.leetcode.com/users/images/c1ea0dda-2ba4-4fd1-9874-017385b54bbc_1700120804.091342.jpeg)\n\n
['Java']