Some tips to ace your DSA Interviews
- Write variables and function names descriptive. Don't use i, j, x, y etc.
- If some code is repeating, never copy paste in two places. Wrap it in a reusable function and call that function multiple times.
- Don't make the length of the code of your main function too big. Try to make different functions for small tasks and call it the main function.
- Don't make too much complicated data types like pair<int, pair<int, int>>, instead make "struct" for it with descriptive names.
- If you are stuck and can't think of any approach then ask for hints. Most interviewers don't mind giving small hints.
- While writing the code don't write silently. Instead keep explaining each and every line while writing.
-
Don't waste time in writing brute force then optimized. Brute force don't have any marks in interviews. You will only get selected on the basis of your optimized solution. Brute solution will just waste your time for later questions.
As soon as you get the question, you can tell the brute force approach verbally under 1 minute but after that spend all your time in explaining and coding optimized solution
All the best for your DSA Interviews