Friday 17 August 2018

Amazon Interview Experience

Amazon SDE II Interview Experience


Amazon SDE II


Written Round
Q1 Given 2 versioned strings A and B. Check if A>B
Return
1       if A>B,
-1      if A0       if A==B

Example #1
101.2.3.2 - A
101.1.3.1 - B
Here A>B because 101 is same but 2>1 and we return 1

Example #2
10.3.4 - A
10.7 - B
Here B>A because 7>3 thus return -1


Q2 Given a binary tree, check if its a Binary Search Tree or not.


Interview Round 1
Q1 Given arrival time and departure time of trains, we need to find the minimum number of platforms needed for the trains.

Q2 Given a matrix for 0's and 1's. We need to find the cost of minimum path to reach from point A to point B in the matrix.
Point A and B are given as input along with the matrix.
In the matrix,
0's indicate no path
1 indicate a path

Note: You can only go up, down, left or right from a given point in matrix.


Interview Round 2
Q1 Subset Sum Problem - Solution

Q2 Given a binary search tree where 2 of its nodes are swapped, you need to find the offending nodes and return the correct binary tree in O(n) time. - Solution

No comments :

Post a Comment