로딩
요청 처리 중입니다...

JAVA_LeetCode 2441_Largest Positive Integer That Exists With Its Negative

 JAVA_LeetCode 2441_Largest Positive Integer That Exists With Its Negative

JAVA_LeetCode 2441_Largest Positive Integer That Exists With Its Negative 풀이 class Solution { public int findMaxK(int[] nums) { // 중복값중 가장 큰값을 추출한다. int res = -1; HashSet set = new HashSet(); for (int num : nums) set.add(num); for (int num : nums){ if (num > 0 && set.contains(-num)) res = Math.max(res, num); } return res; } } * 출처 https://leetcode.com/problems/largest-positive-integer-that-exists-with-its-negative...

# JAVA # JAVA_LargestPositiveIntegerThatExistsWithItsNegative # JAVA_LeetCode2441 # JAVA_LeetCode2441_LargestPositiveIntegerThatExistsWithItsNegative # LeetCode2441_LargestPositiveIntegerThatExistsWithItsNegative