E Piss Bed

code interviews technology

Will Faught

1 minute

EPSBD is a mnemonic I use to remember five helpful approaches to solving algorithmic problems that I got from Cracking the Coding Interview by Gayle McDowell:

  1. Examplify: Derive rules from examples. To compute the angle between the hour and minute hands in a clock, first derive the rules for computing the angle of each hand separately, then derive the rule for computing the angle between the hands in terms of them.
  2. Pattern match: Adapt the solution to a similar problem. To find the smallest element in a sorted array that’s been rotated, you just need to find the discontinuity where the element order changes, so use binary search to find it.
  3. Simplify and generalize: Change a constraint to simplify the solution, then generalize it.
  4. Base case and build: Solve the base cases first, then the cases that build on those.
  5. Data structure brainstorm: In a process of elimination, apply data structures to a problem to find a fit. Applying lateral thinking and praying for luck also fall under this approach.
π