Longest Common Subsequence
Hard
dynamic-programming
string
subsequence
Problem Description
Find the length of longest common subsequence between two strings.
Input Format
Two lines containing the two strings
Output Format
Length of longest common subsequence
Constraints
1 ≤ string length ≤ 1000
Sample Input/Output
Input:
abcde ace
Output:
3
Explanation
LCS is "ace" with length 3
Solution Hints
- Read carefully: Understand input/output format and constraints
- Start simple: Think of brute force solution first, then optimize
- Edge cases: Consider empty inputs, single elements, max constraints
- Data structures: Choose arrays, hash maps, sets based on problem needs
- Time complexity: Ensure your solution fits within time limits
- Test examples: Verify logic with provided sample inputs
260
Points
Points
2000ms
Time Limit
Time Limit
256MB
Memory Limit
Memory Limit
Code Editor
Register to Access Code Editor
Create a free account to solve coding problems and track your progress.
Register Now