Amazon OA Round
Anonymous User
1194

I got 2 question, able to solve fully 1 and for second 7-8 passed. Rest all failed due to TC

  1. Similar to this - https://leetcode.com/discuss/interview-question/5152782/Amazon-or-OA-or-AWS-Task-Scheduler
  2. Giving position of trucks and they are always moving towards end station as it is a gas station. Given a second array indicating extra gas station position in 1-indexing. Calculate the total distance travelled by all the trucks.

Eg - [0,2,5,9,12,18] gas station - [[2,5],[1,3]]. Answer to be returned is [12,18]. Able to solve in o(n^2). One for loop for traversing gas station array and second loop to calculate total distance travelled. However Got tc in 6-7 cases. Not sure how I could have optimized.

Comments (7)