Become A Recursion Pro
Become A Recursion Pro
Recursion Pro
IN JUST 10 DAYS
The final pages contains Pro tips for
mastering recursion.
Do check it out before practicing
these problems
Curated by
Day 1
Question 1
Curated by
Day 2
Question 2
Fibonacci Number
The Fibonacci numbers, commonly denoted F(n) form a
sequence, called the Fibonacci sequence, such that each
number is the sum of the two preceding ones, starting
from 0 and 1. That is,
F(0)= 0, F(1)=1
Example
Input: n = 2
Output: 1
Explanation: F(2) = F(1) + F(0) = 1 + 0 = 1.
Curated by
Day 2
Question 3
Sum of digits
Given a number, N. Find the sum of all the digits of N
Example
Input:
N = 12
Output:
Explanation:
1+2=3
From To
Success
Ashish Joshi Story
Curated by
Question 4
Palindrome String
Example
Input:S = "abba"
Output: 1
Explanation: S is a palindrome
Question 5
Power of Two
x
An integer n is a power of two, if there exists an integer x such that n == 2
Example
Input: n = 1
Output: true
Explanation: 20 = 1
Curated by
Day 3
Question 6
Rope Cutting
You are given N ropes. A cut operation is performed on
ropes such that all of them are reduced by the length of
the smallest rope. Display the number of ropes left after
every cut operation until the length of each rope is zero.
Example
Input : arr[ ] = {5, 1, 1, 2, 3, 5}
Output : 4 3 2
Curated by
Question 7
Valid Parentheses
Given a string s containing just the characters '(', ')', '{', '}',
'[' and ']', determine if the input string is valid.
brackets.
Example
Input: s = "()"
Output: true
Practice
From To
Success
Akansha Likhdhari Story
Curated by
Day 3
Question 8
Pow(x, n)
Example
Output: 1024.00000
Practice
Career Hiring
Highest
One of the best institutes for getting started with DSA and System Design.
Placed at It also assisted me in launching my technical career and in honing my
Curated
Curated by
by
Day 4
Subsets
Example
Input :
array = {1, 2, 3}
Output :
1 2
1 2 3
1 3
2 3
3}.
Curated
Curated by
by
Day 5
Example
Input:
N = 6
sum = 9
Output: 1
= 9.
Curated
Curated by
by
Day 5
Question 11
Example
Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]
Career Hiring
Highest
I really want to thank Tutort Academy from bottom of my heart for helping me
brushing up system design, data structures and algorithms for the Google
Curated
Curated by
by
Day 6
Question 12
Tower of Hanoi
move the entire stack to another rod. You are given the
all the discs reach the 3rd rod. Also, you need to find the
total moves.
Note: The discs are arranged such that the top disc is
Also, all the discs have different sizes and a bigger disc
Example
Input: N = 2
Output:
Curated
Curated by
by
Day 6
Question 13
Josephus Problem
1st place in the circle, you are the last one remaining and
Example
Input:
n = 3
k = 2
Output: 3
Curated
Curated by
by
Day 7
Question 14
String
Example
Input:
S = "geeks"
Output:
g e e k s
g ee k s
printed.
Curated
Curated by
by
Day 8
binary operator ' + ', ' - ', or ' * ' between the digits of S so
value
Note:
Example
Input:
S = "123"target = 6
Curated
Curated by
by
Day 9
Question 16
remain as it is.
You may not alter the values in the list's nodes, only
Example
Curated
Curated by
by
Day 10
Question 17
N-Queens
each other.
Example
Input: n = 4
Output: [[".Q..","...Q","Q...","..Q."],
["..Q.","Q...","...Q",".Q.."]]
puzzle as shown
Curated
Curated by
by
Question 18
Scrambled String
substrings recursively.
"No".
Curated
Curated by
by
Question 18
Scrambled String
Example
Curated
Curated by
by
Here are some tips to help you become
proficient in using recursion:
similar instances.
Visualize Recursion:
Use visualization techniques, such as recursion trees or stack
04 diagrams, to understand the flow of recursive function calls and how
Curated
Curated by
by
Maintain State:
Ensure that the state of your program is maintained correctly across
06 recursive calls. This includes variables, data structures, and other
10
While recursion is elegant, it may not always be the most efficient
performance reasons.
Curated
Curated by
by
Start Your
Upskilling with us
Explore our courses
www.tutort.net
Follow us on