Skip to content

Commit f9b3af1

Browse files
committed
update
1 parent f210fea commit f9b3af1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

✅ Pattern 15: 0-1 Knapsack (Dynamic Programming).md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5867,7 +5867,7 @@ Explanation: Following are the four occurences: {tomorrow, tomorrow, tomorrow, t
58675867
### Basic Brute-force Solution
58685868
This problem follows the <b>[Longest Common Subsequence (LCS) pattern](#pattern-5-longest-common-substring)</b> and is quite similar to the <b>[Longest Repeating Subsequence](#longest-repeating-subsequence)</b>; the difference is that we need to count the total occurrences of the <b>subsequence</b>.
58695869
5870-
A <b>basic brute-force solution</b> could be to try all the <b>subsequences<b> of the given `string` to count all that match the given `pattern`. We can match the pattern with the given `string` one character at a time, so we can do two things at any step:
5870+
A <b>basic brute-force solution</b> could be to try all the <b>subsequences</b> of the given `string` to count all that match the given `pattern`. We can match the pattern with the given `string` one character at a time, so we can do two things at any step:
58715871
1. If the `pattern` has a matching character with the `string`, we can <b>recursively</b> match for the remaining lengths of the `pattern` and the `string`.
58725872
2. At every step, we can always skip a character from the `string` to try to match the remaining `string` with the `pattern`. So we can start a <b>recursive call</b> by skipping one character from the `string`.
58735873

0 commit comments

Comments
 (0)