# Category Archives: Recursion

Given a binary tree and a node start that is initially infected. For every second, neighbours of an infected node get infected. The task is… Read More
Given N nodes, where each of them is numbered from 0 to N – 1, and array edges, where there is a directed edge from… Read More
These are the special type of recursive functions, where the last statement executed inside the function is the call to the function itself. Advantages of… Read More
Given a 2-D array A[][] of size N×3, where each element of the array consists of {x, y, r}, where x and y are coordinates… Read More
A Binary Search Tree or BST is a binary tree where every node to the left of its root has a value less than the… Read More
Given an array arr[] of size N and a given difference diff, the task is to count the number of partitions that we can perform… Read More
Given a positive integer N, the task is to find the number of distinct ways to express N as a sum of positive palindromic integers… Read More
Given an array A[] of positive integers, print all the unique non-empty subsets of the array  Note: The set can not contain duplicate elements, so… Read More
Given N tanks connected like a tree, the connections between them in an array Edge[][], and the capacity of each tank in the array cap[],… Read More
What is a Proper Tail Call? Proper tail calls (PTC) is a programming language feature that enables memory-efficient recursive algorithms. Tail call optimization is where… Read More
Given a number N and a mapping of letters to each integer from 1 to 8, which are: {1: ‘abc’, 2: ‘def’, 3: ‘ghi’, 4: ‘jkl’,… Read More
Given a directed graph with N nodes and M edges in array V[], the task is to find the number of nodes that are accessible… Read More
Given an undirected tree with N nodes numbered from 1 to N and an array A[] where A[i] denotes the value assigned to (i+1)th node.… Read More
Given a string S of length N, the task is to find the number of unique subsequences of the string for each length from 0… Read More
Given a Binary tree, the task is to print the outer cone layer i.e. combination of layers formed by moving only through the left child… Read More