You are given a string S of length N and a string array Arr of tength M.
Fantastic news! We've Found the answer you've been seeking!
Question:
You are given a string S of length N and a string array Arr of tength M.
Find the longest subsequence of S in which each substring of length 2 is
present in the string array Arr.
Notes:
A substring of a string is a contiguous subsequence of that string.
Make a function with parameters (String S, ListArr) and return an INTEGER denoting the longest subsequence of S in which each substring of length 2 is present in the string array Arr.
Sample Test cases:
Case 16abcdef1ab
OUTPUT2
Case 26abacaf2aaad
OUTPUT4
Case 36asgfsd4asagaffs
MAKE SURE ALL TEST CASES PROVIDED RUNS SUCCESSFULLY. THEN SURELY I WILL LIKE THE SOLUTION.
P.S: CODE IN ANY LANGUAGE, CAN TRY IN JAVA.
Related Book For
Posted Date: