Tip 1 : Practice coding questions and participate in online contests.
Tip 2 : Communication skills are good to have for interviews.
Tip 1 : Do some good projects for your resume.
Tip 2 : Keep it concise and short.
Tip 3 : Don't lie on your resume.
Amazon Visited our campus, and they had put a cutoff of 7 CGPA based on which they shortlisted students. After 2 days all the shortlisted students received an online test link.
Online Assessment Test: The round had four sections.
Debugging: There was a total of 7 questions in which a piece of code was written and you had to find any error so that all the test cases can pass. All the questions were very easy.
Coding Section: There were two questions, one was based on a linked list and the other was a logical question based on hashing, I would say both the questions were of medium level. The time allotted was 70 mins total.
Behavioral Analysis: This section consisted of questions that focused on your personality and behavior.
Reasoning Ability: This section was based on aptitude and verbal ability. The difficulty level was easy.



If the first linked list is 1 -> 2 -> 3 -> 4 -> 5 -> NULL and the second linked list is 4 -> 5 -> NULL.
The two numbers represented by these two lists are 12345 and 45, respectively. So, adding these two numbers gives 12390.
So, the linked list representation of this number is 1 -> 2 -> 3 -> 9 -> 0 -> NULL.
The approach is very simple. Traverse both lists and One by one pick nodes of both lists and add the values. If the sum is more than 10 then make carry as 1 and reduce sum. If one list has more elements than the other then consider the remaining values of this list as 0.
The steps are:
1. Traverse the two linked lists from start to end
2. Add the two digits each from respective linked lists.
3. If one of the lists has reached the end then take 0 as its digit.
4. Continue it until both the end of the list.
5. If the sum of two digits is greater than 9 then set carry as 1 and the current digit as sum % 10



We cannot use the element at a given index twice.
Try to do this problem in O(N) time complexity.
This problem can be solved efficiently by using the technique of hashing. Use a hash_map to check for the current array value x(let), if there exists a value target_sum-x which on adding to the former gives target_sum. This can be done in constant time. Let’s look at the following example.
arr[] = {0, -1, 2, -3, 1}
sum = -2
Now start traversing:
Step 1: For ‘0’ there is no valid number ‘-2’ so store ‘0’ in hash_map.
Step 2: For ‘-1’ there is no valid number ‘-1’ so store ‘-1’ in hash_map.
Step 3: For ‘2’ there is no valid number ‘-4’ so store ‘2’ in hash_map.
Step 4: For ‘-3’ there is no valid number ‘1’ so store ‘-3’ in hash_map.
Step 5: For ‘1’ there is a valid number ‘-3’ so the answer is 1, -3
The round began and first, the interviewer introduced himself and later asked me to introduce myself which I did. After that, he walked me through how the interview is going to proceed from there. He then gave me two coding questions, firstly you have to tell them your approach, and if they are satisfied enough or if your approach is the optimum approach then they will ask you to write that code in their code space which is not an editor btw.
After half an hour I got a call from HR that my interview is scheduled an hour later.



So, this was a binary search question and there was an easier version of this question in which you had to find only the integer which is closest to the square root of that number, so here you had to only change your code a bit, but the logic was a bit tricky to find, but eventually, I came up with the solution and then the interviewer was quite impressed. I also had to tell the time and space complexity and also explained to them why was this the most optimal approach.



For the given binary tree [1, 2, 3, -1, -1, 4, 5, -1, -1, -1, -1]
1
/ \
2 3
/ \
4 5
Output: 1 3 2 4 5
Initially, I thought that this was a tricky problem but I kept thinking out loud, and they were also able to see where and how was I thinking, later I came up with the solution and it was the optimum one, the interviewer again asked me to write how will you represent the generic tree, and then I wrote the code for the tree using a class, the interviewer was again happy to see that, later I wrote the code for the problem and also told him the time and space complexities.
Approach: The idea is to use two variables i initialized to 1 and j initialized to the height of the tree and run a while loop which won't break until i becomes greater than j. We will use another variable flag and initialize it to 0. Now in the while loop, we will check a condition that if the flag is equal to 0 we will traverse the tree from right to left and mark the flag as 1 so that next time we traverse the tree from left to right and then increment the value of i so that next time we visit the level just below the current level. Also when we will traverse the level from the bottom we will mark the flag as 0 so that next time we traverse the tree from left to right and then decrement the value of j so that next time we visit the level just above the current level. Repeat the whole process until the binary tree is completely traversed.
The round began with the interviewer’s introduction and then I introduced myself He gave me two questions based on data structures.
The interviewer was happy with all the answers. Then, since enough time was left, He asked me some HR questions, like what are strengths and weaknesses, etc.
After all this, he told me in the interview itself “See you soon and enjoy your day “, after which I was quite sure that I’m going to go to the next round. But this was the last one.



Tip 1 : Try to tell your approach continuously, as if you are stuck then the interviewer might give a hint.
Tip 2 : Be confident and speak what you think.
Tip 3 : Don't give up on the first try, try to come up with some solution. They see your approach.



1. A node will be in the bottom-view if it is the bottom-most node at its horizontal distance from the root.
2. The horizontal distance of the root from itself is 0. The horizontal distance of the right child of the root node is 1 and the horizontal distance of the left child of the root node is -1.
3. The horizontal distance of node 'n' from root = horizontal distance of its parent from root + 1, if node 'n' is the right child of its parent.
4. The horizontal distance of node 'n' from root = horizontal distance of its parent from the root - 1, if node 'n' is the left child of its parent.
5. If more than one node is at the same horizontal distance and is the bottom-most node for that horizontal distance, including the one which is more towards the right.
Input: Consider the given Binary Tree:

Output: 4 2 6 3 7
Explanation:
Below is the bottom view of the binary tree.

1 is the root node, so its horizontal distance = 0.
Since 2 lies to the left of 0, its horizontal distance = 0-1= -1
3 lies to the right of 0, its horizontal distance = 0+1 = 1
Similarly, horizontal distance of 4 = Horizontal distance of 2 - 1= -1-1=-2
Horizontal distance of 5 = Horizontal distance of 2 + 1= -1+1 = 0
Horizontal distance of 6 = 1-1 =0
Horizontal distance of 7 = 1+1 = 2
The bottom-most node at a horizontal distance of -2 is 4.
The bottom-most node at a horizontal distance of -1 is 2.
The bottom-most node at a horizontal distance of 0 is 5 and 6. However, 6 is more towards the right, so 6 is included.
The bottom-most node at a horizontal distance of 1 is 3.
The bottom-most node at a horizontal distance of 2 is 7.
Hence, the bottom view would be 4 2 6 3 7
Tip 1 : Try to tell your approach continuously, as if you are stuck then the interviewer might give a hint.
Tip 2 : Be confident and speak what you think.
Tip 3 : Don't give up on the first try, try to come up with some solution. They see your approach.

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?