Skip to content
This repository was archived by the owner on Apr 20, 2024. It is now read-only.

Commit 613734c

Browse files
committed
added problem64
1 parent 9fe763a commit 613734c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

problem64/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# 1143. Longest Common Subsequence
2+
3+
Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0.
4+
5+
A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
6+
7+
For example, "ace" is a subsequence of "abcde".
8+
A common subsequence of two strings is a subsequence that is common to both strings.
9+
10+
11+
# Example 1:
12+
13+
Input: text1 = "abcde", text2 = "ace"
14+
Output: 3
15+
Explanation: The longest common subsequence is "ace" and its length is 3.
16+
17+
## Example 2:
18+
19+
Input: text1 = "abc", text2 = "abc"
20+
Output: 3
21+
Explanation: The longest common subsequence is "abc" and its length is 3.
22+
23+
## Example 3:
24+
25+
Input: text1 = "abc", text2 = "def"
26+
Output: 0
27+
Explanation: There is no such common subsequence, so the result is 0.
28+
29+
30+
## Constraints:
31+
32+
1 <= text1.length, text2.length <= 1000
33+
text1 and text2 consist of only lowercase English characters.

0 commit comments

Comments
 (0)