Amazon | Onsite | SDE 6M Intern

amazon logo
amazon
sde 6m internonsite
December 2, 202117 reads

Summary

I interviewed for an SDE 6M Intern position at Amazon onsite. The interview primarily focused on data structures and algorithms, where I was asked two distinct coding problems, one of which I solved in O(nlogk).

Full Experience

I recently had an onsite interview for the SDE 6M Intern role at Amazon. The interview session consisted of two challenging data structures and algorithms problems. I provided my solutions and approaches for both questions.

Interview Questions (2)

Q1
Partition Array Around Target Value
Data Structures & AlgorithmsMedium

Given an array of integers and a target value, return array such that the values that are less than target should be on left side of the array and values that are greater than target should be on right side of the array. Values that are equal to target should be in between other values.

Example:

nums = [9, 12, 5, 10, 14, 3, 10], target = 10
return = [9, 5, 3, 10, 10, 12, 14

nums=[-3, 4, 3, 2], target = 2
Output: [-3, 2, 4, 3]

Q2
Sort K-Sorted Array
Data Structures & AlgorithmsMedium

You are given an array of integers and value k. Values in array are displaced by up to k position. Return the sorted array in most optimal way.

Example:

nums = [20, 30, 10, 40, 60, 50, 70, 100, 80, 90], k = 2
return = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!