Sort by

recency

|

1330 Discussions

|

  • + 0 comments

    Notably, you need to change the inputs for the function to cases and widths, as well as removing n from both the function and the part of the program that calls the function in main to avoid a segmentation fault, especially when dealing with dynamic data like rta cabinets wholesale dimensions.

  • + 0 comments

    Instead of passing the length of width, directly pass width in parameter.

    public static List<Integer> serviceLane(List<List<Integer>> cases, List<Integer> width) {
        // Write your code here
       
            List<Integer> maxSizeVehicle = new ArrayList<Integer>();
            for (List<Integer> i : cases) {
                int a = 0;
                for (int j = i.get(0); j <= i.get(1); j++) {
                    if (j == i.get(0)) {
                        a = width.get(j);
                    } else if (a > width.get(j)) {
                        a = width.get(j);
                    } else if (a == width.get(j)) {
                         a = width.get(j);
                    }
                    if (j == i.get(1)) {
                        maxSizeVehicle.add(a);
                    }
                }
            }
            return maxSizeVehicle;
        }
    
  • + 0 comments

    Notably, you need to change the inputs for the function to cases and widths, as well as removing n from both the function and the part of the program that calls the function in main to avoid a segmentation fault.

  • + 0 comments

    two changes :

    24 : public static List< Integer> serviceLane(int n, List< Integer> width, List< List< Integer>> cases) {

    60 : List< Integer> result = Result.serviceLane(n, width, cases);

  • + 0 comments

    n should be replaced with width. then:

    def serviceLane(width, cases): return [min(width[c[0]:c[1]+1]) for c in cases]