Problem Brief
Find Longest Subsequence Common to X as Substring in Y (MLE :)
NEW GRADOA
See Salesforce online assessment and hiring insights
Given two strings x and y, find the longest subsequence of x that is also a substring of y. Return the maximum length of such a subsequence.
1Example 1
Input
x = "hackerranks", y = "hackers"
Output
7
Explanation
The entire string "hackers" is a substring of
y and also a subsequence of x (characters appear in order). The maximum length is 7.