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

JAVA_Set Mismatch_LeetCode 645

 JAVA_Set Mismatch_LeetCode 645

JAVA_Set Mismatch_LeetCode 645 풀이 class Solution { public int[] findErrorNums(int[] nums) { int[] res = new int[2]; for (int i = 0; i < nums.length; i++) { int index = Math.abs(nums[i]) - 1; if (nums[index] < 0) res[0] = (index + 1); else nums[index] = -1 * nums[index]; } for (int i = 0; i < nums.length; i++) { if (nums[i] > 0) res[1] = (i + 1); } return res; } } * 출처 Set Mismatch - LeetCode Set Mismatch - You have a set of integers s, which originally contains all the numbers from 1 to n. Unfor...

# JAVA # JAVA_LeetCode645 # JAVA_SetMismatch # JAVA_SetMismatch_LeetCode645 # SetMismatch_LeetCode645