r/codinginterview • • May 12 '20

Remainder using Recursion

  • Deriving equation to solve a problem

  • Time complexity for equation based implementation

  • Solving the problem by hand (brute force)

  • Solving the problem by translating manual steps to iterative code

  • Recognizing nothing to be done in combine step using recursion diagram

  • Trivial combine step in recursion leads to tail recursion

  • Comparison of iterative and recursive solution to see how terminating condition maps to base case, result and reduced value are the same in this case

Modulo using Recursion

2 Upvotes

1 comment sorted by