package leetcode;

/**
 * https://leetcode.com/problems/random-point-in-non-overlapping-rectangles/
 */
public class Problem497 {
    private static class Solution {
        public Solution(int[][] rects) {
        }

        public int[] pick() {
            // TODO
            return null;
        }
    }

    public static void main(String[] args) {
    }
}

@@ -12,16 +12,93 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Random;%0A%0A
 /**%0A * h
@@ -249,124 +249,640 @@
    p
-ublic Solution(int%5B%5D%5B%5D rects) %7B%0A        %7D%0A%0A        public int%5B%5D pick() %7B%0A            // TODO%0A            return null
+rivate final List%3Cint%5B%5D%3E rects = new ArrayList%3C%3E();%0A        private final Random random = new Random();%0A%0A        public Solution(int%5B%5D%5B%5D rects) %7B%0A            for (int i = 0; i %3C rects.length; i++) %7B%0A                int area = area(rects%5Bi%5D);%0A                if (area %3E 0) %7B%0A                    this.rects.add(rects%5Bi%5D);%0A                %7D%0A            %7D%0A        %7D%0A%0A        public int%5B%5D pick() %7B%0A            int index = random.nextInt(rects.size());%0A            int%5B%5D rect = rects.get(index);%0A            return null;%0A        %7D%0A%0A        private static int area(int%5B%5D rect) %7B%0A            return (rect%5B0%5D - rect%5B2%5D) * (rect%5B1%5D * rect%5B3%5D)
 ;%0A  
@@ -937,20 +937,21 @@
 g%5B%5D args) %7B%0A
+%0A
     %7D%0A%7D%0A

Update problem 497