Tip 1: DSA may seem dull at first, but never neglect it.
Tip 2: Master the basics before jumping to advanced topics like segment trees.
Tip 3: The interviewer wants to check your mindset not your solutions so try to explore different approaches.
Tip 1: Have some good projects on resume.
Tip 2: Mention your ranks and achievements in competitive programming, along with links to your coding profiles, if any.
The interviewer was very calm and made me feel comfortable right from the start. We began with a brief introduction where I talked about myself, my hobbies, and some college experiences. After that, he moved on to discussing my projects. I had listed three projects on my resume, but we had an in-depth discussion on one of them, which he chose, for about 10 minutes.



You are given an array with multiple duplicate elements, but there is exactly one unique element. Your task is to identify this unique element.
Step 1: I initially solved the problem using a hash map, where I iterated through the array to count the occurrences of each element and then identified the unique one. This was a brute-force approach.
Step 2: The interviewer asked me to optimize the solution.
Step 3: I then implemented an optimized solution using the XOR operator. The interviewer was satisfied with this approach, and we moved on to the next problem.



Given an array arr[] of integers, the task is to find the Next Greater Element (NGE) for each element in the array. The NGE for an element x is the first greater element on its right side in the array. If no greater element exists, consider from the start of the index.
Step 1: I solved the problem using a brute-force approach, where I iterated through the array for each element to find the next greater element.
Step 2: The interviewer asked me to optimize the solution.
Step 3: I then implemented an efficient solution using a stack, which reduces the time complexity to O(N). The interviewer was satisfied with this approach, and we moved on to the next problem.
Here one thing happened when I said that I will be using stack, he asked me that how will I implement stack, I reverted that I will be using C++ STL, but we can implement it using Array or using Linked List. So he asked me to do so using array, which I tried but on failing I was allowed to use the library. So you must keep your basics foundation strong.



Given an array nums[] of N integers, your task is to find the k most frequent elements in the array.
Example:
Input: nums = [1, 1, 1, 2, 2, 3], k = 2
Output: [1, 2]
Explanation: 1 appears three times, and 2 appears twice, making them the top 2 frequent elements.
Step 1: I first conveyed the approach using a hash map to count the frequency of each element.
Step 2: To track the top k frequent elements, I used a priority queue of size k to store pairs of (frequency, number). This helps in efficiently maintaining the elements with the highest frequencies.
Step 3 (Optimization): The optimized solution relies on the hash map for frequency counting, which provides O(N) time complexity for counting. The heap operations for maintaining the top k elements are O(log k), making the overall complexity efficient. I coded this one only and not the brute force approach.
With just 3 minutes left in the interview, the interviewer shifted the focus to development-related questions. He asked me to create a small UI component using JavaScript library. (Learn)
I was familiar with the concept and the logic required to build the component. However, I needed a refresher on the exact syntax. I managed to code the component successfully with the interviewer’s guidance, as I was able to recall the necessary steps while working through it.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?