Skip to content

Commit 522592a

Browse files
Merge pull request #33 from codewithdhruba01/codewithdhruba01-patch-1
Add recursion practice questions to README
2 parents 5b3242b + 65acf50 commit 522592a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

12_Recursion/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,41 @@ RecursionError: maximum recursion depth exceeded
144144
- Avoid recursion if **memory constraints are a concern**.
145145

146146
---
147+
148+
## Practice Questions :
149+
150+
### 🔹 **Basic Level**
151+
152+
1. **Factorial of a number** nikalne ke liye recursive function likho.
153+
➤ Example: `factorial(5) = 120`
154+
155+
2. **Fibonacci series** ka nth term recursive function se find karo.
156+
➤ Example: `fibonacci(6) = 8`
157+
158+
3. **Sum of first n natural numbers** recursively nikalne ka program likho.
159+
➤ Example: `sum_n(5) = 15`
160+
161+
4. **Reverse a string** using recursion.
162+
➤ Example: `reverse("hello") = "olleh"`
163+
164+
5. **Find the sum of digits** of a given number using recursion.
165+
➤ Example: `sum_digits(1234) = 10`
166+
167+
---
168+
169+
### 🔹 **Intermediate Level**
170+
171+
6. **Check palindrome string** using recursion.
172+
➤ Example: `"madam" → True`, `"hello" → False`
173+
174+
7. **Find GCD (Greatest Common Divisor)** of two numbers using recursion.
175+
➤ Example: `gcd(48, 18) = 6`
176+
177+
8. **Calculate power of a number** (xⁿ) using recursion.
178+
➤ Example: `power(2, 5) = 32`
179+
180+
9. **Count number of elements in a list** recursively (without using `len()`).
181+
➤ Example: `count([1, 2, 3, 4]) = 4`
182+
183+
10. **Find maximum element in a list** using recursion.
184+
➤ Example: `max_recursive([5, 2, 9, 1, 7]) = 9`

0 commit comments

Comments
 (0)