시간 복잡도 O(n^2)
public int solution(int[] elements) {
Set<Integer> set = new HashSet<>();
for (int start = 0; start < elements.length; start++) {
int sum = 0;
for (int end = start; end < start + elements.length; end++) {
sum += elements[end % elements.length];
set.add(sum);
}
}
return set.size();
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/131701