package leetcode;

import java.util.Arrays;

/**
 * https://leetcode.com/problems/queries-on-number-of-points-inside-a-circle/
 */
public class Problem1828 {
    public int[] countPoints(int[][] points, int[][] queries) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1828 prob = new Problem1828();
        System.out.println(Arrays.toString(prob.countPoints(new int[][]{
            {1,3},{3,3},{5,3},{2,2}
        }, new int[][]{
            {2,3,1},{4,3,1},{1,1,2}
        }))); // [3,2,2]
        System.out.println(Arrays.toString(prob.countPoints(new int[][]{
            {1,1},{2,2},{3,3},{4,4},{5,5}
        }, new int[][]{
            {1,2,2},{2,2,2},{4,3,2},{4,3,3}
        }))); // [2,3,2,4]
    }
}

@@ -16,34 +16,8 @@
 e;%0A%0A
-import java.util.Arrays;%0A%0A
 /**%0A
@@ -201,538 +201,676 @@
     
-// TODO%0A        return null;
+int%5B%5D answer = new int%5Bqueries.length%5D;%0A        for (int i = 0; i %3C queries.length; i++) %7B
 %0A    
-%7D%0A%0A
+  
     
-public static void main(String%5B%5D args) %7B%0A        Problem1828 prob = new Problem1828();%0A        System.out.println(Arrays.toString(prob.countPoints(new int%5B%5D%5B%5D%7B%0A            %7B1,3%7D,%7B3,3%7D,%7B5,3%7D,%7B2,2%7D%0A        %7D, new int%5B%5D%5B%5D%7B%0A            %7B2,3,1%7D,%7B4,3,1%7D,%7B1,1,2%7D%0A        %7D))); // %5B3,2,2%5D%0A        System.out.println(Arrays.toString(prob.countPoints(new int%5B%5D%5B%5D%7B%0A            %7B1,1%7D,%7B2,2%7D,%7B3,3%7D,%7B4,4%7D,%7B5,5%7D%0A        %7D, new int%5B%5D%5B%5D%7B
+  for (int j = 0; j %3C points.length; j++) %7B%0A                int x1 = queries%5Bi%5D%5B0%5D;%0A                int y1 = queries%5Bi%5D%5B1%5D;%0A                int r = queries%5Bi%5D%5B2%5D;%0A                int x2 = points%5Bj%5D%5B0%5D;%0A                int y2 = points%5Bj%5D%5B1%5D;%0A                if (withinCircle(x1, x2, y1, y2, r)) %7B%0A                    answer%5Bi%5D++;%0A                %7D%0A            %7D%0A        %7D%0A        return answer;
 %0A    
+%7D%0A%0A
     
-    %7B1,2,2%7D,%7B2,2,2%7D,%7B4,3,2%7D,%7B4,3,3%7D%0A        %7D))); // %5B2,3,2,4%5D
+private static boolean withinCircle(int x1, int x2, int y1, int y2, int radius) %7B%0A        return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)) %3C= radius;
 %0A   

Solve problem 1828