From 3c6f8ef4ed665ece9144503bb63d0b7c29e5f662 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Wed, 23 Aug 2023 16:08:00 +0800 Subject: [PATCH 1/2] feat: update solutions to lc problem: No.1987 --- .../1987.Number of Unique Good Subsequences/README.md | 9 +++------ .../1987.Number of Unique Good Subsequences/README_EN.md | 9 +++------ .../1987.Number of Unique Good Subsequences/Solution.cpp | 3 +-- .../Solution.java | 3 +-- .../1987.Number of Unique Good Subsequences/Solution.ts | 3 +-- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md b/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md index 5f3fcc5a53c94..74d48330c1bef 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md @@ -113,8 +113,7 @@ class Solution { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + f + g) % mod; return ans; } } @@ -137,8 +136,7 @@ public: f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + f + g) % mod; return ans; } }; @@ -178,8 +176,7 @@ function numberOfUniqueGoodSubsequences(binary: string): number { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + g + f) % mod; return ans; } ``` diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md b/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md index da83e44d394f3..8e309c6dd3d20 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md @@ -89,8 +89,7 @@ class Solution { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + f + g) % mod; return ans; } } @@ -113,8 +112,7 @@ public: f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + f + g) % mod; return ans; } }; @@ -154,8 +152,7 @@ function numberOfUniqueGoodSubsequences(binary: string): number { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + g + f) % mod; return ans; } ``` diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.cpp b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.cpp index 0d025ea06a351..730c6d767ac19 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.cpp +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.cpp @@ -12,8 +12,7 @@ class Solution { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + f + g) % mod; return ans; } }; \ No newline at end of file diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.java b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.java index 09ccae7f5f91f..6d4f11b81ca9b 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.java +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.java @@ -11,8 +11,7 @@ public int numberOfUniqueGoodSubsequences(String binary) { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + f + g) % mod; return ans; } } \ No newline at end of file diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts index db88dd75b4f51..b634b804ea180 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts @@ -10,7 +10,6 @@ function numberOfUniqueGoodSubsequences(binary: string): number { f = (f + g + 1) % mod; } } - ans = (ans + f) % mod; - ans = (ans + g) % mod; + ans = (ans + g + f) % mod; return ans; } From bf3b0c2d9e623a0ebe3ed51a7968f75293eebca3 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Wed, 23 Aug 2023 16:14:13 +0800 Subject: [PATCH 2/2] fix: unified --- .../1900-1999/1987.Number of Unique Good Subsequences/README.md | 2 +- .../1987.Number of Unique Good Subsequences/README_EN.md | 2 +- .../1987.Number of Unique Good Subsequences/Solution.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md b/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md index 74d48330c1bef..cec12bc676a28 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/README.md @@ -176,7 +176,7 @@ function numberOfUniqueGoodSubsequences(binary: string): number { f = (f + g + 1) % mod; } } - ans = (ans + g + f) % mod; + ans = (ans + f + g) % mod; return ans; } ``` diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md b/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md index 8e309c6dd3d20..86fb09554a750 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/README_EN.md @@ -152,7 +152,7 @@ function numberOfUniqueGoodSubsequences(binary: string): number { f = (f + g + 1) % mod; } } - ans = (ans + g + f) % mod; + ans = (ans + f + g) % mod; return ans; } ``` diff --git a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts index b634b804ea180..9eff4fc79544e 100644 --- a/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts +++ b/solution/1900-1999/1987.Number of Unique Good Subsequences/Solution.ts @@ -10,6 +10,6 @@ function numberOfUniqueGoodSubsequences(binary: string): number { f = (f + g + 1) % mod; } } - ans = (ans + g + f) % mod; + ans = (ans + f + g) % mod; return ans; }