public static int solution(int[] elements) {
Set<Integer> set = new HashSet<>();
for (int start = 1; start <= elements.length; start++) {
for (int i = 0; i < elements.length; i++) {
int value = 0;
for (int j = i; j < i + start; j++) {
value += elements[j % elements.length];
}
set.add(value);
}
}
return set.size();
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/131701