Find all increasing subsequences of an array
Given an integer array, find all distinct increasing subsequences of length two or more.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer array, find all distinct increasing subsequences of length two or more.
Given an array of distinct positive integers, find the total number of distinct permutations that add up to a given target, where each array element may be used any number of times.
Given a binary tree, where each node stores a value between 0 and 9, calculate the sum of the numbers created by the paths from root to leaf.
Given a linked list, remove all nodes from it that match a given key.
Given a positive integer n
and a target, find all combinations of distinct numbers in the interval [1,9]
of length n
that add up to the target.
Given a binary tree and an integer k
, count the total number of paths in the tree whose sum of all nodes is equal to k
.
Given an integer array, shrink it by removing adjacent triplets that satisfy the given constraints and return the total number of elements in the resultant array.
Given a BST, count the total number of nodes that lie within a given range.
An Eulerian trail (or Eulerian path) is a path in a graph that visits every edge exactly once. Given a directed graph, check whether it has an Eulerian path or not.
Given a linked list, construct a complete binary tree from it. Assume that the order of elements present in the linked list is the same as that in the complete tree’s array representation.
Given a binary tree, check if removing an edge can split it into two binary trees of equal size.
Given two height-balanced binary search trees, in-place merge them into a single balanced binary search tree. For each node of a height-balanced tree, the difference between its left and right subtree height is at most 1.