We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Instead of passing the length of width, directly pass width in parameter.
publicstaticList<Integer>serviceLane(List<List<Integer>>cases,List<Integer>width){// Write your code hereList<Integer>maxSizeVehicle=newArrayList<Integer>();for(List<Integer>i:cases){inta=0;for(intj=i.get(0);j<=i.get(1);j++){if(j==i.get(0)){a=width.get(j);}elseif(a>width.get(j)){a=width.get(j);}elseif(a==width.get(j)){a=width.get(j);}if(j==i.get(1)){maxSizeVehicle.add(a);}}}returnmaxSizeVehicle;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Service Lane
You are viewing a single comment's thread. Return to all comments →
Instead of passing the length of width, directly pass width in parameter.