Recursion Leetcode Questions
A collection of 20 Leetcode questions focused on recursion, categorized into easy, medium, and hard levels.
Easyβ
- Factorial
- Description: Calculate the factorial of a given number using recursion.
- Fibonacci Number
- Description: Compute the n-th Fibonacci number using recursion.
- Reverse String
- Description: Reverse a string using recursion.
- Sum of Digits of a Number
- Description: Find the sum of digits of a given number using recursion.
- Power of Three
- Description: Determine if a number is a power of three using recursion.
- Climbing Stairs
- Description: Find the number of ways to climb a staircase using recursion.
- Palindrome Linked List
- Description: Check if a linked list is a palindrome using recursion.
- Maximum Depth of Binary Tree
- Description: Find the maximum depth of a binary tree using recursion.
Mediumβ
- Subsets
- Description: Generate all possible subsets of a set using recursion.
- Permutations
- Description: Generate all possible permutations of a sequence using recursion.
- Unique Binary Search Trees II
- Description: Generate all unique BSTs that store values 1 to n using recursion.
- Word Search
- Description: Search for a word in a 2D grid using recursion.
- Combination Sum
- Description: Find all unique combinations of numbers that sum to a target using recursion.
- Letter Combinations of a Phone Number
- Description: Generate all possible letter combinations that a phone number could represent using recursion.
- Generate Parentheses
- Description: Generate all combinations of well-formed parentheses using recursion.
Hardβ
- N-Queens
- Description: Solve the N-Queens problem using recursion.
- Sudoku Solver
- Description: Solve a given Sudoku puzzle using recursion.
- Regular Expression Matching
- Description: Implement regular expression matching with support for '.' and '*' using recursion.
- Longest Valid Parentheses
- Description: Find the length of the longest valid parentheses substring using recursion.
- Interleaving String
- Description: Determine if a string is an interleaving of two other strings using recursion.
These questions provide a comprehensive overview of recursion techniques and are a great way to practice and improve your recursion skills in data structures and algorithms.