Select Page

Amazon Interview Experience for SDE (On-Campus)

Akanksha Singh
Published: September 30, 2022

View Discussion

Improve Article

Save Article

Like Article

View Discussion

Improve Article

Save Article

Like Article

Technical-Round (Duration-1hr):

  • Introduction
  • Diameter of Tree
  • Given two arrays old_profit and new_profit of length n where old_profit[ i ] and new_profit[ i ] represent profit from shop in the old city and new city respectively at day i+1. You have to shift the shop from the old city to the new city such that the total profit is maximum. Find the maximum profit.

Example:


old_profit = [5 , 25, 10, 7 , 9 , 11]
new_profit= [10 , 5,  11, 13, 7, 14]

Output: 75
Explanation:

 Day  -  Profit   
1       -  5    
2       -   25
Now shift the shop to new place
3       -  11
4       -  13
5       -   7
6       -   14
So the total maximum profit becomes 75
  • Would you be able to switch to another language?

NOTE:

  • Firstly Interviewer asked me for an approach once he was fully satisfied with the approach then he told me to do the code. When I was done with coding, he gave me some test cases to dry run. After that, he asked me about space and time Complexity of code.
  • I was free to code in any language  ( I chose Python).
  • There was only one interview round.

Source: www.geeksforgeeks.org