Technique where a function calls itself to solve smaller instances of the same problem.
Problem Statement: Given the root node of a binary search tree (BST) and a value val to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the new valu...
Problem Statement: Given a Binary Search Tree and a key, return the floor of the given key in the Binary Search Tree. Floor of a value refers to the value of the largest node in the Binary Search T...
Problem Statement: Given a Binary Search Tree and a key, return the ceiling of the given key in the Binary Search Tree. Ceiling of a value refers to the value of the smallest node in the Binary Sea...
Problem Description: Given an integer N, write a program to print your name N times. Examples Input: N = 3 Output: Ashish Ashish Ashish Explanation: Name is printed 3 times. Input: N = 1 Output: As...
What is Recursion? Recursion is a programming technique where a function calls itself directly or indirectly to solve a problem, by breaking it down into smaller subproblems until it reaches a base...
Problem Description: Given an integer N, write a program to print numbers from N to 1. Examples Input: N = 4 Output: 4, 3, 2, 1 Explanation: All the numbers from 4 to 1 are printed. Input: N = 1 Ou...
Problem Description: Given an integer N, write a program to print numbers from 1 to N. Examples Input: N = 4 Output: 1, 2, 3, 4 Explanation: All the numbers from 1 to 4 are printed. Input: N = 1 Ou...
Problem Description: Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. Examples Input: s =...
Problem Description: Given an integer array arr with length n, and an integer k, you may partition arr into one or more contiguous sub-arrays, where each sub-array has length in the range [1, k] (b...
Problem Statement: Given an n * m matrix of ones and zeros, return how many square submatrices have all ones. Examples Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1]] Output: 15 Expla...