Tag Archives: subsequence

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 »

Count Distinct Subsequences

Given a string, find count of distinct subsequences of it. Examples: Input : str = “gfg” Output : 7 The seven distinct subsequences are “”, “g”, “f”, “gf”, “fg”, “gg” and “gfg” Input : str = “ggg” Output : 4 The six distinct subsequences are “”, “g”, “gg” and “ggg” The problem of counting distinct… Read More »