Digital Marketing

General workflow to solve a recursion problem


  1. Define the recursion function;
  2. Write down the recurrence relation and base case;
  3. Use memoization to eliminate the duplicate calculation problem, if it exists.
  4. Whenever possible, implement the function as tail recursion, to optimize the space complexity.

Comments

Popular posts from this blog

Fixed WSL sshd: no hostkeys available -- exiting

PowerMTA pmta command

How to fix: mv: failed to preserve ownership