Amazon | Onsite | SDE 6M Intern
- Location
- onsite
- Posted
- 2 Dec 2021
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).
How it went
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.
Questions asked (2)
- 01
Partition Array Around Target Value
Data Structures & Algorithms · Medium
Open the problemGiven 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, 14nums=[-3, 4, 3, 2], target = 2
Output: [-3, 2, 4, 3] - 02
Sort K-Sorted Array
Data Structures & Algorithms · Medium
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]