Tag Archives: subsequence

Given two positive integers N and K, the task is to print all possible K-length subsequences from first N natural numbers whose sum of elements… Read More
Given an array arr[] consisting of N integers and an array Queries[][] with each query of the form {x, y}. For each query, the task… Read More
Given an array arr[] of size N, the task is to find the longest non-empty subsequence from the given array whose sum is maximum. Examples:… Read More
Given a string str of length N, the task is to print all possible distinct subsequences of the string str which consists of non-repeating characters… Read More
Given an array arr[] consisting of N unique elements, the task is to generate an array B[] of length N such that B[i] is the… Read More
Given a binary string, str, the task is to empty the given string by minimum number of removals of a single character or a subsequence… Read More
Given a string str, consisting of lowercase alphabets, the task is to find the shortest string which is not a subsequence of the given string.… Read More
Given two arrays arr1[] and arr2[] of length M and N consisting of digits [0, 9] representing two numbers and an integer K(K ≤ M… Read More
Given an array arr[] of size N, the task is to count the number of longest increasing subsequences present in the given array. Examples: Input:… Read More
Given an array arr[] of length N, the task is to find the Bitwise OR of the sum of all possible subsequences from the given… Read More
Given an array arr[], the task is to find the length of the longest subsequence of the array arr[] such that all adjacent elements in… Read More
C++ filter_none edit close play_arrow link brightness_4 code // C++ program of the // above approach   #include <cstring> #include <iostream>   using namespace std;… Read More
Given two strings S1 and S2, the task is to check if it’s possible to generate string S2 by repeatedly appending subsequences of S1 to… Read More
Given two arrays arr[] and arr1[] of lengths N and M respectively, the task is to find the longest increasing subsequence of array arr[] such… Read More
Given a string S of length N, the task is to find the lexicographically smallest subsequence of length (N – 1), i.e. by removing a… Read More