-
CyclicRotationStudy/알고리즘 2018. 1. 11. 16:17
점수 : 75점.
public static int[] solution(int[] A, int K){ int []tempArray = new int[A.length]; for(int j = 0 ; j < K; j++){ int i = 0; while(i < A.length){ if(i != A.length -1){ int temp = A[i]; tempArray[i+1] = temp; } else{ int temp = A[i]; tempArray[0] = temp; } i++; } A = tempArray.clone(); // for(int a : tempArray){ // System.out.print(a); // System.out.print(","); // } // System.out.println(); } return tempArray; }
'Study > 알고리즘' 카테고리의 다른 글
PassingCars (0) 2018.01.12 CountDiv (0) 2018.01.12 MaxCounters (0) 2018.01.12 MissingInteger (0) 2018.01.12 FrogRiverOne (0) 2018.01.12 PermCheck (0) 2018.01.11 PermMissingElem (0) 2018.01.11 FrogJmp (0) 2018.01.11 OddOccurrencesInArray (0) 2018.01.11 BinaryGap (0) 2018.01.11 댓글