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.
The problem in the question is that they have entered n as a parameter which is the length of the list width instead of the list itself, to solve, you require the list width, so just replace n with width and the program would work.
Python 3 Solution:
defserviceLane(width,cases):# Write your code herecase=dict(enumerate(width))temp=max(width)lst=[]foriincases:temp=max(width)forjinrange(i[0],i[1]+1):ifcase[j]<temp:temp=case[j]lst.append(temp)returnlst
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 →
The problem in the question is that they have entered n as a parameter which is the length of the list width instead of the list itself, to solve, you require the list width, so just replace n with width and the program would work.
Python 3 Solution: