-
DistinctStudy/알고리즘 2018. 1. 15. 16:49
오늘은 코딩이 참 안되네.....
https://app.codility.com/demo/results/trainingN7Y4C8-9B5/
public static int solution(int[] A){ ArrayList
array = new ArrayList<>(); int checkInt = 0; for(int i = 0 ; i < A.length; i++){ checkInt = A[i]; boolean isDistinct = false; for(int j = 0 ; j < array.size() ; j++){ if(A[i] == array.get(j) ){ isDistinct = true; } } if(!isDistinct){ array.add(checkInt); } } return array.size(); } 'Study > 알고리즘' 카테고리의 다른 글
fish (0) 2018.01.19 Brackets (0) 2018.01.18 NumberOfDiscIntersections (0) 2018.01.16 MaxProductOfThree (0) 2018.01.16 Triangle (0) 2018.01.15 MinAvgTwoSlice (0) 2018.01.15 GenomicRangeQuery (0) 2018.01.15 PassingCars (0) 2018.01.12 CountDiv (0) 2018.01.12 MaxCounters (0) 2018.01.12 댓글