Problem Submissions Solution

Longest Common Subsequence

Difficulty: Medium

Acceptance: %

Points: 30.00

Given two strings, s1 and s2, the task is to find the length of the Longest Common Subsequence. If there is no common subsequence, return 0. A subsequence is a string generated from the original string by deleting 0 or more characters, without changing the relative order of the remaining characters.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(m * n)

Expected Auxiliary Space: O(m * n)

where m and n are sizes of s1 and s2 respectively.

Constraints:
  • 1<= m, n <=10^3
  • Both strings s1 and s2 contain only uppercase English letters.
Companies:
Amazon Microsoft
Topics:
Array String Dynamic Programming
Locked Content
Access Restricted: Please Login to access the code editor and test cases.