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

JAVA_LeetCode 1013_Partition Array Into Three Parts With Equal Sum

 JAVA_LeetCode 1013_Partition Array Into Three Parts With Equal Sum

JAVA_LeetCode 1013_Partition Array Into Three Parts With Equal Sum 풀이 class Solution { public int[] arrayRankTransform(int[] arr) { // 배열을 복사한다음 정렬한다. int[] arr2 = arr.clone(); Arrays.sort(arr2); HashMap map=new HashMap(); // putIfAbsent를 이용하여 정렬된 요소값을 키로 오름차순 값을 저장한다. for(int i = 0; i < arr2.length; i++) map.putIfAbsent(arr2[i], map.size()+1); // 오름차순 값을 기존 배열 요소값으로 초기화해준다. for(int i = 0; i < arr2.length; i++) arr[i] = map.get(arr[i]); return arr; } } * 출처 https://leetcode.co...

# JAVA # JAVA_LeetCode1013 # JAVA_LeetCode1013_PartitionArrayIntoThreePartsWithEqualSum # JAVA_PartitionArrayIntoThreePartsWithEqualSum # LeetCode1013_PartitionArrayIntoThreePartsWithEqualSum