# Amazon Interview Experience for SDE-1

Hey guys recently I appeared for an SDE 1 interview in Amazon and wanted to share my experience to help others

Round 1(HackerEarth):

Q1. You need to find out the longest subsequence of a string from a given string such that the absolute difference between two alternating characters of the subsequence is less than K.
Q2. You are on an infinite graph and starting from (1, 1), you can move either (x+y, y) or (x, x+y) and you need to find out whether you can reach the given point or not.
Q3. Given a set of numbers, you need to find out the number of ways you can divide the set into two groups such that no two groups are left empty.

Round 2:

Q1. Given two strings containing a special character ‘#’ which represents a backspace, you need to print true if both the strings will be equal after processing the backspaces.
Example:

AA##BCAS#
B#BCA

Output:
True
(Expected time complexity: O(n))
(Expected space complexity: O(1))

Round 3:

Q2. Implement a stack that can do operations like push, pop, find the mid element and delete the mid element in O(1).
Q3. Given a binary tree and a key, print all the elements in the path from the key to the root.

Round 4:

Q2. Given a directory tree, you need to find out kth largest file. (Expected time complexity n log k)
Q3. Given a staircase and you can take either 2 jumps and or 1 jump at a time you need to find out the number of ways you can reach to n-th stairs.
Follow up: there are some stairs which are broken and you cannot jump ahead from those broken stairs.

Round 5:

Q2. Given a graph and you are starting from point 0, 0. You will be given commands like:
forward 40
right 50
left 30
backward 70
You need to print your location after processing these commands.
(Behavioural questions)
Q3. Tell me a mistake you regret the most in your professional life?
Q5. What is your college CGPA?

Round 6:

Q2. Why are you looking for a change?
Q3. The interviewer asked me to tell me some other approach for the questions asked in the 2nd round.
Q4. Tell me about the project you are working on in your current company.

From Round 2-5 I was told to write the code in pen and paper and they expecting a production-level code that means no compilation issue and no syntax errors and all the errors and edge cases handled.

Some tips:

• You must know how to calculate the time and space complexities of the problems.
• In each round you can be asked about the project you recently did/ the project you liked working most/most challenging work etc- so you should be prepared well for at least one project with in-depth details.
• Start with the naive approach for each question asked and then proceed with solutions with better space and time complexities.
• They mostly care about the projects you did and your coding skills whether you cover all the edge cases while writing code, know time and space complexities, have better approaches for solving the same problem and so on.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.