Skip to content

Some tips to ace your DSA interviews

Seven habits for DSA interviews: readable code, small functions, asking for hints, explaining as you write, and skipping brute force.

Post 2 of 121 min readInterviews

  1. Write variables and function names descriptive. Don't use i, j, x, y etc.

  2. If some code is repeating, never copy paste in two places. Wrap it in a reusable function and call that function multiple times.

  3. 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.

  4. Don't make too much complicated data types like pair<int, pair<int, int>>, instead make "struct" for it with descriptive names.

  5. If you are stuck and can't think of any approach then ask for hints. Most interviewers don't mind giving small hints.

  6. While writing the code don't write silently. Instead keep explaining each and every line while writing.

  7. 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