package leetcode;

import java.util.List;

/**
 * https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance/
 */
public class Problem1333 {
    public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice, int maxDistance) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1333 prob = new Problem1333();
        System.out.println(prob.filterRestaurants(
            new int[][]{{1,4,1,40,10},{2,8,0,50,5},{3,8,1,30,4},{4,10,0,10,3},{5,1,1,15,1}},
        1, 50, 10)); // [3,1,5]
        System.out.println(prob.filterRestaurants(
            new int[][]{{1,4,1,40,10},{2,8,0,50,5},{3,8,1,30,4},{4,10,0,10,3},{5,1,1,15,1}},
            0, 50, 10)); // [4,3,2,1,5]
        System.out.println(prob.filterRestaurants(
            new int[][]{{1,4,1,40,10},{2,8,0,50,5},{3,8,1,30,4},{4,10,0,10,3},{5,1,1,15,1}},
            0, 30, 3)); // [4,5]
    }
}

@@ -33,13 +33,107 @@
 til.
+Array
 List;
+%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;
 %0A%0A/*
@@ -383,174 +383,300 @@
     
-// TODO%0A        return null;%0A
+List%3Cint%5B%5D%3E list = new ArrayList%3C%3E();%0A        for (int%5B%5D restaurant : restaurants) %7B%0A 
     
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1333 prob = new Problem1333();%0A        System.out.println(prob.filterR
+   if (restaurant%5B3%5D %3C= maxPrice && restaurant%5B4%5D %3C= maxDistance) %7B%0A                if ((veganFriendly == 1 && restaurant%5B2%5D == veganFriendly) %7C%7C veganFriendly == 0) %7B%0A                    list.add(r
 esta
@@ -672,34 +672,34 @@
 t.add(restaurant
-s(
+);
 %0A            new
@@ -699,481 +699,303 @@
     
-new int%5B%5D%5B%5D%7B%7B1,4,1,40,10%7D,%7B2,8,0,50,5%7D,%7B3,8,1,30,4%7D,%7B4,10,0,10,3%7D,%7B5,1,1,15,1%7D%7D,%0A        1, 50, 10)); // %5B3,1,5%5D%0A        System.out.println(prob.filterRestaurants(%0A            new int%5B%5D%5B%5D%7B%7B1,4,1,40,10%7D,%7B2,8,0,50,5%7D,%7B3,8,1,30,4%7D,%7B4,10,0,10,3%7D,%7B5,1,1,15,1%7D%7D,%0A            0, 50, 10)); // %5B4,3,2,1,5%5D%0A        System.out.println(prob.filterRestaurants(%0A            new int%5B%5D%5B%5D%7B%7B1,4,1,40,10%7D,%7B2,8,0,50,5%7D,%7B3,8,1,30,4%7D,%7B4,10,0,10,3%7D,%7B5,1,1,15,1%7D%7D,%0A            0, 30, 3)); // %5B4,5%5D
+    %7D%0A            %7D%0A        %7D%0A        Collections.sort(list, (a, b) -%3E %7B%0A            int cmp = b%5B1%5D - a%5B1%5D;%0A            if (cmp == 0) %7B%0A                return b%5B0%5D - a%5B0%5D;%0A            %7D%0A            return cmp;%0A        %7D);%0A        return list.stream().map(a -%3E a%5B0%5D).collect(Collectors.toList());
 %0A   

Solve problem 1333