Count of subsequences in an array with sum less than or equal to X
Given an integer array arr[] of size N and an integer X, the task is to count the number of subsequences in that array such that its sum is less than or equal to X. Note: 1 <= N <= 1000 and 1 <= X <= 1000, where N is the size of the array....
read more
Count of possible subarrays and subsequences using given length of Array
Given an integer N which denotes the length of an array, the task is to count the number of subarray and subsequence possible with the given length of the array.Examples:...
read more
Count the number of contiguous increasing and decreasing subsequences in a sequence
For a given distinct integer sequence of size N, the task is to count the number of contiguous increasing subsequence and contiguous decreasing subsequence in this sequence.Examples:...
read more
Print all Increasing Subsequence of a List
Given a list or array of integer, the task is to print all such subsequences of this list such in which the elements are arranged in increasing order.A Subsequence of the list is an ordered subset of that list’s element having same sequential ordering as the original list. Examples:...
read more
Check whether a subsequence exists with sum equal to k if arr[i]> 2*arr[i-1]
Given a sorted array of positive integers where arr[i] > 2*arr[i-1], check whether a sub sequence exists whose sum is equal to k.Examples:...
read more
Lexicographically largest sub-sequence of the given string
Given string str containing lowercase characters, the task is to find the lexicographically largest sub-sequence of str....
read more
Print all subsequences of a string using ArrayList
Given a string str, the task is to print all the sub-sequences of str. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.Examples:...
read more
Transform a string such that it has abcd..z as a subsequence
Given a string S of only small English letters. We need to transform the string by making some number of moves (any number of times) to get the string “abcdefghijklmnopqrstuvwxyz” as a subsequence in that string. In one move, you can replace any character of the string with the next character in alphabetical order i.e. ‘a’ can be replaced by ‘b’, ‘b’ can be replaced by ‘c’ and so on. Letter ‘z’ cannot be replaced by any character. If it is not possible to get the subsequence out of that string, then print “Not Possible”....
read more
Longest Increasing Odd Even Subsequence
Given an array of size n. The problem is to find the length of the subsequence in the given array such that all the elements of the subsequence are sorted in increasing order and also they are alternately odd and even. Note that the subsequence could start either with the odd number or with the even number....
read more
Maximum length prefix of one string that occurs as subsequence in another
Given two strings s and t. The task is to find maximum length of some prefix of the string S which occur in string t as subsequence....
read more
Minimum number of subsequences required to convert one string to another using Greedy Algorithm
Given two strings A and B consists of lowercase letters, the task to find the minimum number of subsequence required to form A from B. If it is impossible to form, print -1.Examples:...
read more
Print Longest Bitonic subsequence (Space Optimized Approach)
Given an array arr[] of size N, the task is to print the longest bitonic subsequence of the given array.Note: If more than one solution exit then prints anyone solution....
read more