is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
aasshishh's solution in Python:
- pythonuser March 29, 2014def minRange(lll):
import heapq
heap = []
num_elts = 0
for k in range(0,len(lll)):
li = lll[k]
if len(li)==0:
print 'none of the lists can be empty'
return 0
num_elts += len(li)
heapq.heappush(heap,(li[0],k))
oldrangemin = min(heap)[0]
oldrangemax = max(heap)[0]
oldheaprange = oldrangemax - oldrangemin
for i in range(0,num_elts):
heap_min_elt = heapq.heappop(heap)
k = heap_min_elt[1]
heap_new_elt = lll[k].pop(0)
heapq.heappush(heap, (heap_new_elt,k))
rangemin = min(heap)[0]
rangemax = max(heap)[0]
newheaprange = rangemax - rangemin
if newheaprange < oldheaprange:
oldheaprange = newheaprange
oldrangemin = rangemin
oldrangemax = rangemax
if len(lll[k])==0:
break
return [oldrangemin, oldrangemax]
>>>my_list_of_lists = [[2,50,60],[10,20,40],[2,3,100],[4,5,6]]
>>>minRange(my_list_of_lists)
>>>[2, 10]