Tag Archives: subsequence

Find largest word in dictionary by deleting some characters of given string

Giving a dictionary and a string ‘str’, find the longest string in dictionary which can be formed by deleting some characters of the given ‘str’. Examples: Input : dict = {“ale”, “apple”, “monkey”, “plea”} str = “abpcplea” Output : apple Input : dict = {“pintu”, “geeksfor”, “geeksgeeks”, ” forgeek”} str = “geeksforgeeks” Output : geeksgeeks… Read More »

Queries on subsequence of string

Given a string S and Q queries, each query contains a string T. The task is print “Yes” if T is subsequence of S, else print “No”. Examples: Input : S = “geeksforgeeks” Query 1: “gg” Query 2: “gro” Query 3: “gfg” Query 4: “orf” Output : Yes No Yes No For each query, using… Read More »

Maximum sum Bi-tonic Sub-sequence

Given an array of integers. A subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Examples: Input : arr[] = {1, 15, 51, 45, 33, 100, 12, 18, 9} Output : 194 Explanation : Bi-tonic Sub-sequence are : {1, 51, 9} or {1, 50, 100, 18, 9} or {1, 15, 51,… Read More »