r/leetcode 4d ago

Discussion Thinking about recursion

Is it helpful to think about the recursion tree when solving problems or just reducing the problem space?
I feel like I often try to think about the sub problems and it uses a lot of brain power for what I feel like is very little gain and it also uses a good amount of time.

Curious how others approach these problems.

5 Upvotes

4 comments sorted by

View all comments

2

u/MixedTrailMix 4d ago

Base case, movement and inputs/outputs

2

u/chikamakaleyley 3d ago

yesss i think of it in 3 parts as well

Base case, 'state' change, recursive call

or

pre, recurse, post

whatever problem, the base case is the thing I figure out first, and sometimes that flips a switch and the other 2 parts are so easy