Created
October 20, 2022 02:12
-
-
Save RakhmedovRS/31ece65053aa029c2cffe9db03a894be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Map<Integer, Integer> valueToCount = new HashMap<>(); | |
| int max = 0; | |
| for (int num : nums) { | |
| int count = valueToCount.getOrDefault(num, 0) + 1; | |
| valueToCount.put(num, count); | |
| max = Math.max(max, count); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment