You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DSA Crack Sheet/README.md
+1
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,7 @@
83
83
-[Min Number of Flips](https://practice.geeksforgeeks.org/problems/min-number-of-flips/0#"view question") - [Cpp Solution](./solutions/Min%20Number%20of%20Flips.cpp)
84
84
-[Second most repeated string in a sequence](https://practice.geeksforgeeks.org/problems/second-most-repeated-string-in-a-sequence0534/1#"view question") - [Cpp Solution](./solutions/Second%20most%20repeated%20string%20in%20a%20sequence.cpp)
85
85
-[Minimum Swaps for Bracket Balancing](https://practice.geeksforgeeks.org/problems/minimum-swaps-for-bracket-balancing/0#"view question") - [Cpp Solution](./solutions/Minimum%20Swaps%20for%20Bracket%20Balancing.cpp)
86
+
-[Longest Common Subsequence](https://practice.geeksforgeeks.org/problems/longest-common-subsequence-1587115620/1"view question") - [Cpp Solution](./solutions/Longest%20Common%20Subsequence.cpp)
Given two sequences, find the length of longest subsequence present in both of them. Both the strings are of uppercase.
6
+
7
+
Example 1:
8
+
Input:
9
+
A = 6, B = 6
10
+
str1 = ABCDGH
11
+
str2 = AEDFHR
12
+
Output: 3
13
+
Explanation: LCS for input Sequences
14
+
“ABCDGH” and “AEDFHR” is “ADH” of
15
+
length 3.
16
+
17
+
Example 2:
18
+
Input:
19
+
A = 3, B = 2
20
+
str1 = ABC
21
+
str2 = AC
22
+
Output: 2
23
+
Explanation: LCS of "ABC" and "AC" is
24
+
"AC" of length 2.
25
+
Your Task:
26
+
Complete the function lcs() which takes the length of two strings respectively and two strings as input parameters and returns the length of the longest subsequence present in both of them.
0 commit comments