Tip 1: Be clear about the basics of data structures and learn how to build the logic for a problem. Then, try to find a solution, starting from a brute force approach and progressing to an optimized solution.
Tip 2: As a fresher, it's important to have at least two good projects. You should definitely have a clear understanding of what your project is about and be able to answer related questions during the interview.
Tip 3: The number of DSA questions you solve doesn't matter. What matters is having an understanding of how to approach a particular question, knowing which data structures to use, and being able to find a better solution.
Tip 1: Highlight the technical skills in which you excel.
Tip 2: Have at least two good projects on your resume.



We cannot use the element at a given index twice.
Try to do this problem in O(N) time complexity.
Step 1: Initialize an empty hash map (numToIndexMap) to store the numbers seen so far and their corresponding indices.
Step 2: Iterate over the array using a for loop.
For each number nums[i], calculate the difference diff between the target and the current number (diff = target - nums[i]).
Step 3: Check if diff exists in numToIndexMap. If it does, it means the two numbers that add up to the target have been found. Return their indices [i, numToIndexMap.get(diff)].
Step 4: If diff does not exist in the map, store the current number and its index in numToIndexMap.
Step 5: If no such pair is found by the end of the loop, return null. (However, according to the problem constraints, a solution is guaranteed, so this case won't occur.)

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?