Tip 1: Revise core concepts daily and focus more on understanding than on memorizing solutions.
Tip 2: Practice coding problems related to arrays, strings, and basic algorithms consistently.
Tip 3: Revise backend concepts such as API flow, database interactions, and common design patterns before interviews.
Tip 1: Clearly mention your tech stack and explain exactly what you worked on in each project.
Tip 2: Keep the resume short and relevant to the role, instead of adding unrelated technologies.
Tip 3: Include real internship or job experience if available, not just academic projects.



Step 1: First, I considered checking all substrings and verifying if the characters were unique, which would take O(n²) time.
Step 2: Then I used the sliding window technique with two pointers and a set to track unique characters in the current window.
Step 3: When a duplicate character was found, I moved the left pointer until the window again contained only unique characters.
Step 4: I updated the maximum length during each valid window. This reduced the time complexity to O(n).



Input: 'a' = [7, 12, 1, 20]
Output: NGE = [12, 20, 20, -1]
Explanation: For the given array,
- The next greater element for 7 is 12.
- The next greater element for 12 is 20.
- The next greater element for 1 is 20.
- There is no greater element for 20 on the right side. So we consider NGE as -1.
Step 1: Initially, I considered a brute-force approach, where for each element I would scan the right side to find a greater element, resulting in O(n²) time complexity.
Step 2: Then I realized this could be optimized using a stack. I traversed the array while maintaining a stack of elements whose next greater element had not yet been found.
Step 3: When the current element was greater than the top of the stack, I popped elements and assigned the current value as their next greater element.
Step 4: The remaining elements in the stack were assigned -1. This approach worked in O(n) time.

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