Recursion
Practice base cases, call traces, and recursive decomposition.
Use https://mlprep.pages.dev/programming/recursion/. If window.mlPrepAgent is available, read local attempt history before planning. Help me work through the set without revealing full answers first, and save each real attempt through the bridge with recorded_by agent and agent_session_id when available. Keep the tutoring session self-contained in this chat. Fetch the problem and any available reference solution from ML Prep or the cited source. Include everything I need to solve the problem without opening a link. Show the solution only when I ask or when we review my attempt. Say if you can't access the problem or reference solution, and distinguish your own solution from the reference.Recommended resources
- MIT 6.100L Introduction to CS and Programming using Python — MIT OpenCourseWare
- LeetCode Problem Set — LeetCode
Instructions
- Write the base case before the recursive step.
- Trace one nontrivial input by hand.
Ordered items
- —
- —
- —
Completion
Implement each recursive function without slicing or hidden global state.