package leetcode;

/**
 * https://leetcode.com/problems/count-good-triplets/
 */
public class Problem1534 {
    public int countGoodTriplets(int[] arr, int a, int b, int c) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1534 prob = new Problem1534();
        System.out.println(prob.countGoodTriplets(new int[]{3,0,1,1,9,7}, 7, 2, 3)); // 4
        System.out.println(prob.countGoodTriplets(new int[]{1,1,2,2,3}, 0, 0, 1)); // 0
    }
}

@@ -180,309 +180,479 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1534 prob = new Problem1534();%0A        System.out.println(prob.countGoodTriplets(new int%5B%5D%7B3,0,1,1,9,7%7D, 7, 2, 3)); // 4%0A        System.out.println(prob.countGoodTriplets(new int%5B%5D%7B1,1,2,2,3%7D, 0, 0, 1)); // 0
+int answer = 0;%0A        for (int i = 0; i %3C arr.length; i++) %7B%0A            for (int j = i + 1; j %3C arr.length; j++) %7B%0A                for (int k = j + 1; k %3C arr.length; k++) %7B%0A                    if (Math.abs(arr%5Bi%5D - arr%5Bj%5D) %3C= a &&%0A                        Math.abs(arr%5Bj%5D - arr%5Bk%5D) %3C= b &&%0A                        Math.abs(arr%5Bi%5D - arr%5Bk%5D) %3C= c) %7B%0A                        answer++;%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1534