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 a Directed Acyclic Graph (DAG), print all its topological orderings. A Topological ordering of a directed graph G is a linear ordering of the nodes as v1, v2,…,vn such that all edges point forward: for every edge (vi, vj), we have i < j.
Given a directed graph and two vertices (say source and destination vertex), determine if the destination vertex is reachable from the source vertex or not. If a path exists from the source vertex to the destination vertex, print it.
Find all n–digit numbers with an equal sum of digits at even and odd index, where n varies from 1 to 9.
Given an unsorted integer array, print all triplets in it with a sum less than or equal to a given number.
Given a positive integer n, print all combinations of numbers between 1 and n having sum n.
Write a program to count the number of ways to calculate a target number from the specified array elements using only addition and subtraction operator. The use of any other operator is forbidden.
Given an M × N rectangular grid, print all shortest routes in the grid that start at the first cell (0, 0) and ends at the last cell (M-1, N-1). We can move down or right or diagonally (down-right), but not up or left.
Given a set S, generate all distinct subsets of it, i.e., find a distinct power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.
In the k–partition problem, we need to partition an array of positive integers into k disjoint subsets that all have an equal sum, and they completely cover the set.
In this post, we will see how to list out all permutations of a string in Python.
Given a binary tree, write a recursive algorithm to print all paths from leaf to root node.