Tip 1 - Practice Data Structure questions as much as you can. Also, be confident during the interview about your solution. For practice, you can prefer Coding Ninjas and Geeks For Geeks.
Tip 2 - Read About amazon leadership principles
Tip 1 : Keep it short. Mention the academic and professional projects you've done. Add your educational details properly with the percentage or CGPA obtained.
Tip 2 : Only write those things in the resume which you are confident of and keep practicing.
There were 2 data structure questions to be done in 70 minutes and 20 minutes for workstyle assessments.



A string ‘B’ is a substring of a string ‘A’ if ‘B’ that can be obtained by deletion of, several characters(possibly none) from the start of ‘A’ and several characters(possibly none) from the end of ‘A’.
Two strings ‘X’ and ‘Y’ are considered different if there is at least one index ‘i’ such that the character of ‘X’ at index ‘i’ is different from the character of ‘Y’ at index ‘i’(X[i]!=Y[i]).
The idea is to build a trie for all suffixes of the given string. We will use the fact that every substring of ‘S’ can be represented as a prefix of some suffix string of ‘S’. Hence, if we create a trie of all suffixes of ‘S’ then the number of distinct substrings will be equal to the nodes in the trie. This is because for every substring there will be only one path from the root node of the trie to the last character of the substring, hence no duplicate substrings will be present in the trie.



Input: 'arr' = [1, 2, 7, -4, 3, 2, -10, 9, 1]
Output: 11
Explanation: The subarray yielding the maximum sum is [1, 2, 7, -4, 3, 2].
We maintain an array curSum[], which keeps track of the maximum sum of the subarray ending at the index we’re at.
While traversing the array, If the value of curSum[i] becomes negative, we can simply discard this part of the array because it has a negative contribution to the subarray sum. It would be better to just drop that part and have a zero contribution rather than a negative one. Then, we can start anew with the next element. In other words, curSum[i] can be reset to 0.
The maximum value in the curSum array will be our answer.
It was a coding Round
The interview started with his introduction and the told me to introduce myself and then told he will be paste a question in the text editor and I have to write a production-level code for the same



For every house k, there are two options: either to rob it (include this house: i) or not rob it (exclude this house: e).
Include this house:
i = num[k] + e (money of this house + money robbed excluding the previous house)
Exclude this house:
e = max(i, e) (max of money robbed including the previous house or money robbed excluding the previous house)
(note that i and e of the previous step, that's why we use tmp here to store the previous i when calculating e, to make O(1) space)



we have 2 pointers: slow and fast. Slow pointer takes a single jump and corresponding to every jump slow pointer takes, fast pointer takes 2 jumps. If there exists a cycle, both slow and fast pointers will reach the exact same node. If there is no cycle in the given linked list, then the fast pointer will reach the end of the linked list well before the slow pointer reaches the end or NULL.
It was again DSA round, taken by an SDE- 2 at amazon In which they asked me 2 DSA problems.



1. Each of the digits 1 - 9 must occur exactly once in each row.
2. Each of the digits 1 - 9 must occur exactly once in each column.
3. Each of the digits 1 - 9 must occur exactly once in each of the 9, 3 x 3 sub-matrices of the matrix.
1. There will always be a cell in the matrix which is empty.
2. The given initial matrix will always be consistent according to the rules mentioned in the problem statement.
Used Backttracking to Solve the problem




For the given binary tree: the LCA of (7,8,10) is 1
All of the node values of the binary tree will be unique.
N1, N2, and N3 will always exist in the binary tree.
Used Preorder Traversal to solve the problem

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?