Recursion — [Index]
Jul 18, 2023
Parent article ↗
· How to identify recursion base condition
· DP vs Recursion
· Tail recursion/Tail-Call Optimization
· Complexity analysis for recursion
· Modulo 10⁹+7
How to identify recursion base condition
Think of smallest valid input .
- Think of smallest valid input .
- For example — https://leetcode.com/problems/target-sum/
public int findTargetSumWays(int[] nums, int target){}
➝ smallest valid input is empty nums array and
➝ target is 0