Leetcode Interview Tips

Coding artifacts

  • actual code
  • variable and method names
  • algorithms

Non-coding artifacts

i am not that good at the coding artifacts so i need to leverage the non coding artifacts

steps to leverage the non coding artifacts

clarify the requirements

  • clarify ambiguous elements
    • is the array pre-filled
  • clarify the edge cases
  • clarify the use cases NB: immediately write down the definitions for all methods before you start coding

code the brute force

  • code the brute force solution first before trying to code the most efficient solution

ask whether to code the brute force solution or its just okay to describe it

NB: constantly clarify what you are abt to do next with the interviewer

constantly clarify what you are abt to do next with the interviewer

transform from brute force to optimized solution

  • there are gonna be two scenarios at this point
  1. i might know the optimized solution cause i already did same type of questions
  2. i don’t know what to do and i need time to come up with the solution
  • if choice 1

  • if choice 2

    • communicate with the interviewer as much as possible
    1. state the flows with the brute force solution
    2. describe what you are thinking at each point

code with the optimized solution

testing and analysis

coding artifact is done at this point so just show your non coding artifacts in a way that shows you are a careful programmer

  • go through line by line and test it with example
  • test the edge cases as well
    • empty arrays
    • negative numbers in the analysis step list the use cases not the time and space complexity