Sum 1 to N
Problem
Given a positive integer n, return the sum of all integers from 1 to n using recursion.
Example 1: Input: n = 5
Output: 15
1+2+3+4+5=15
Output: 15
1+2+3+4+5=15
Example 2: Input: n = 1
Output: 1
Output: 1
Need a second perspective?Open this exact problem in ChatGPT with a Socratic coaching prompt.
Ask ChatGPT ↗Why this mattersInstalls the most basic recursion reflex: identify smallest input (base case), express larger input in terms of smaller one.
Your theory book
A sentence in your own words is more useful than another saved solution.What will you remember when the surface changes?
← → navigate ⌘+Enter run