public class Solution {
int rslt = 0;
int getSum(int[] arr, boolean[] visited, int n) {
int sum = 0;
for (int i = 0; i < n; i++) {
if (visited[i]) {
sum += arr[i];
}
}
return sum;
}
void comb(int[] arr, boolean[] visited, int start, int n, int r) {
if(r == 0) {
int sum = getSum(arr, visited, n);
if(sum == 0) {
rslt++;
}
return;
}
for(int i=start; i<n; i++) {
visited[i] = true;
comb(arr, visited, i + 1, n, r - 1);
visited[i] = false;
}
}
public int solution(int[] number) {
comb(number, new boolean[number.length], 0, number.length, 3);
return rslt;
}
}