Clicky

My notes on coding interviews

April 10, 2021

Technics and tips

  1. Consider searches within hashmaps
  2. Consider storing number of ocurrences with hashmaps
  3. When using recursion consider keeping track of visited paths with an array
  4. When using recursion consider keeping track of previous scores with an hashmap
  5. Fast checks for elements of type X via stack (e.g. is there any parking place for buses?)
  6. Fast lookup if element X via hashmaps (e.g. where is the vehicle with this license place?)
  7. Sorted arrays lead to binary search (log n - At each step we reduce the seach space by half)

Recursion

  1. With numbers start from the number and go down to zero.
  2. Think recursion comming from the base case up to the starting point

Binary search

  1. Run while start <= finish; after each loop increase start or decrease finish in order to break the initial condition

Test cases to cover

Zero test case

[0,0,0]

Mirror test case

[3,2,1,0,0,1,2,3]

[-3,-2,-1,0,0,1,2,3]

__note 1: before starting solving ask in which direction should your anwser go, Systems Design, Class Hierarchy, etc. __note 2: show systematic approach, dont just to the solution, make questions and draw assumptions __note 3: determine bottle necks, data/performance/etc __note 4: write top 3 unique/selling points, concentrate on those