Amazon Interview Report
- 0of 0 votes
AnswersGiven a list of n gas station of form P(D,X) where D is the distance from this station to next station and X is the amount of petrol available at this station, identify the starting station from where you can complete journey to each station in order from 1.....N. You can only go in one direction i.e from P(i) to P(i+1)
- ravigupt January 26, 2013 in India
EDIT: I forgot to mention that travelling distance K consumes K units of gas.
EDIT2: I proposed an O(n^2) solution, then interviewer asked me if I can do better.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.