Sort by

recency

|

1327 Discussions

|

  • + 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]

  • + 0 comments

    I think the actual puzzle is fixing the code :)

    public static List<Integer> serviceLane(int n, List<Integer> widths, List<List<Integer>> cases) {
        List<Integer> result = new LinkedList<>();
        for(List<Integer> _case:cases) {
            int start = _case.get(0);
            int end = _case.get(_case.size()-1);
    
            int min = widths.subList(start, end+1).stream().min(Integer::compare).get();
            result.add(min);
        }
        return result;
    }
    
  • + 0 comments

    Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-service-lane-problem-solution.html

  • + 0 comments

    there is no width array being passed, you can not complete this one