Smallest number
Given two integers s and d. The task is to find the smallest number such that the sum of its digits is s and the […]
Given two integers s and d. The task is to find the smallest number such that the sum of its digits is s and the […]
Given an array arr consisting of only 0‘s and 1‘s in random order. Modify the array in-place to segregate 0s onto the left side and 1s
You are given a weighted undirected graph having n vertices numbered from 1 to n and m edges along with their weights. Find the shortest path between the
Given a binary tree and an integer target, check whether there is a root-to-leaf path with its sum as target. Examples : Input: tree
You are given a square binary grid. A grid is considered binary if every value in the grid is either 1 or
Given a binary matrix mat of size n * m, find out the maximum length of a side of a square sub-matrix with all 1s. Examples: Input:
Given an array, arr of integers, and another number target, find three integers in the array such that their sum is closest to
Given a sorted (in ascending order) and rotated array arr of distinct elements which may be rotated at some point and given
Given a Binary Tree and an integer target. Find all the ancestors of the given target. Note: The ancestor of node x is node y, which is
Given a Binary Tree, complete the function to populate the next pointer for all nodes. The next pointer for every
Given a Binary Tree. You need to find and return the vertical width of the tree. Examples : Input: 1
Given a binary tree, your task is to find all duplicate subtrees from the given binary tree. Duplicate Subtree : Two