Tip 1: For Amazon, make DSA your primary focus. Practice consistently and cover problems of varying difficulty.
Tip 2: During interviews, think aloud while explaining your approach. If you start going off track, interviewers often provide subtle hints, so stay attentive.
Tip 1: Highlight your key achievements clearly to make your profile stand out.
Tip 2: Keep your writing crisp and to the point, avoiding unnecessary details.



We have to apply binary search for answer.

We have to apply string matching algorithm. So I used KMP algorithm.
Round started with an introduction. There were two interviewers. I had to solve 2 DSA questions in 50 minutes. I was able to solve and code in 35 minutes.



Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
Example 1:
Input: s = "bcabc"
Output: "abc"
Example 2:
Input: s = "cbacdcbc"
Output: "acdb"
Constraints:
1 <= s.length <= 10^4
s consists of lowercase English letters.
I had used monotonic stack solution. Interviewer was satisfied.



Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.
Example 1:
Input: nums = [1,1,1,2,2,3], k = 2
Output: [1,2]
Example 2:
Input: nums = [1], k = 1
Output: [1]
Constraints:
1 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
k is in the range [1, the number of unique elements in the array].
It is guaranteed that the answer is unique.
Used Priority queue/ Heap. Interviewer was satisfied.

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?