JAVA_Third Maximum Number_LeetCode 414


JAVA_Third Maximum Number_LeetCode 414

JAVA_Third Maximum Number_LeetCode 414 풀이 class Solution { public int thirdMax(int[] nums) { Set<Integer> hash = new HashSet<>(); for (int num : nums) { hash.add(num); } if (hash.size() >= 3) { hash.remove(Collections.max(hash)); hash.remove(Collections.max(hash)); } return Collections.max(hash); } } * 출처 Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com...


#JAVA #JAVA_LeetCode414 #JAVA_ThirdMaximumNumber #JAVA_ThirdMaximumNumber_LeetCode414 #ThirdMaximumNumber_LeetCode414

원문링크 : JAVA_Third Maximum Number_LeetCode 414