Decode Ways

In Decode Ways problem we have given a non-empty string containing only digits, determine the total number of ways to decode it using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Example S = “123” Number of ways to decode this string is 3 If we …

Read more

Longest Palindromic Subsequence

In the longest palindromic subsequence problem we have given a string, find the length of the longest palindromic subsequence. Examples Input: TUTORIALCUP Output: 3 Input: DYNAMICPROGRAMMING Output: 7 Naive Approach for Longest Palindromic Subsequence The naive approach to solve the above problem is to generate all the subsequences of the …

Read more

Translate »