Add office photos
Amazon logo
Engaged Employer

Amazon

Verified
4.1
based on 25.2k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
SDE Intern
Fresher
Clear (1)

Amazon SDE Intern Interview Questions and Answers

Updated 31 Dec 2024

Q1. Find the square root of a number using only 4 basic arithmetic operations (+,-,*,/) without using a power operator and inbuilt libraries. For numbers that are not perfect squares, print the integer part of the...

read more
Ans.

Find square root of a number using basic arithmetic operations without power operator and inbuilt libraries.

  • Use binary search to find the integer part of the square root

  • Use long division method to find the decimal part of the square root

  • Repeat the above steps until desired accuracy is achieved

  • Handle edge cases like negative numbers and numbers less than 1

Add your answer
right arrow

Q2. Given a sorted linked list, how can you remove duplicates from it?

Ans.

Remove duplicates from a sorted linked list

  • Use two pointers - one to iterate through the list and another to keep track of unique elements

  • Compare current node with next node, if they are equal, skip the next node

  • Repeat until end of list is reached

Add your answer
right arrow
Amazon SDE Intern Interview Questions and Answers for Freshers
illustration image

Q3. Addition of two linked lists, and finallt return the result as a linked list

Ans.

Addition of two linked lists and return the result as a linked list.

  • Traverse both linked lists simultaneously

  • Add corresponding nodes and carry over the sum

  • Create a new linked list with the sum

Add your answer
right arrow

Q4. Find leaf nodes in a binary tree ,followed by printing path to leaf nodes.

Ans.

Find leaf nodes in a binary tree and print path to each leaf node.

  • Traverse the binary tree using depth-first search (DFS)

  • When reaching a leaf node, store the path from root to that leaf node

  • Repeat the process for all leaf nodes in the tree

Add your answer
right arrow
Discover Amazon interview dos and don'ts from real experiences

Q5. Deepest left node in binary tree

Ans.

Find the deepest left node in a binary tree.

  • Traverse the tree recursively and keep track of the depth and whether the current node is a left node.

  • If the current node is a leaf node and its depth is greater than the deepest left node found so far, update the deepest left node.

  • Return the deepest left node found.

  • Example: For the binary tree with root node 1, left child 2, and left child of 2 being 4, the deepest left node is 4.

  • Example: For the binary tree with root node 1, left ...read more

Add your answer
right arrow

Q6. Count occurrences in sorted array

Ans.

Count occurrences of a given element in a sorted array.

  • Use binary search to find the first and last occurrence of the element.

  • Subtract the indices to get the count.

  • Handle edge cases like element not present in the array.

Add your answer
right arrow

Q7. Implement Min-stack using O(N) space .

Ans.

Min-stack is implemented using O(N) space by keeping track of minimum value at each element.

  • Use two stacks - one to store the actual elements and another to store the minimum value at each step.

  • When pushing an element, check if it is smaller than the current minimum and update the minimum stack accordingly.

  • When popping an element, also pop from the minimum stack if the popped element is the current minimum.

Add your answer
right arrow

Q8. Implementation of Min Stack

Ans.

Implement a stack that supports push, pop, top, and retrieving the minimum element in constant time.

  • Use two stacks - one to store the actual elements and another to store the minimum values.

  • When pushing an element, check if it is smaller than the current minimum and push it to the min stack if so.

  • When popping an element, check if it is the current minimum and pop from the min stack if so.

  • Top operation can be implemented by returning the top element of the main stack.

  • GetMin op...read more

Add your answer
right arrow

Q9. Sliding Window Problem.

Ans.

Sliding Window Problem involves finding a subarray of fixed size k with the maximum sum.

  • Use a sliding window approach to iterate through the array and keep track of the sum of elements within the window.

  • Slide the window by removing the first element and adding the next element in each iteration.

  • Keep track of the maximum sum found so far and update it if a new maximum is found.

Add your answer
right arrow

More about working at Amazon

Back
Awards Leaf
AmbitionBox Logo
Top Rated Mega Company - 2024
Awards Leaf
Awards Leaf
AmbitionBox Logo
Top Rated Company for Women - 2024
Awards Leaf
Awards Leaf
AmbitionBox Logo
Top Rated Internet/Product Company - 2024
Awards Leaf
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Amazon SDE Intern

based on 13 interviews
3 Interview rounds
Coding Test Round - 1
Coding Test Round - 2
Technical Round
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Recently Viewed
COMPANY BENEFITS
Dilip Buildcon
304 benefits
COMPANY BENEFITS
Dilip Buildcon
304 benefits
COMPANY BENEFITS
IRB Infrastructure
60 benefits
COMPANY BENEFITS
KNR Constructions
20 benefits
JOBS
Browse jobs
Discover jobs you love
SALARIES
Collabera Technologies
INTERVIEWS
Collabera Technologies
No Interviews
INTERVIEWS
AXIS MY INDIA
No Interviews
SALARIES
Collabera Technologies
INTERVIEWS
Deloitte
No Interviews
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter