diff --git a/solution/0700-0799/0781.Rabbits in Forest/README.md b/solution/0700-0799/0781.Rabbits in Forest/README.md
index a3cdab7dc9fe3..ba4b1c52bf77e 100644
--- a/solution/0700-0799/0781.Rabbits in Forest/README.md
+++ b/solution/0700-0799/0781.Rabbits in Forest/README.md
@@ -31,10 +31,10 @@ tags:
输入:answers = [1,1,2]
输出:5
解释:
-两只回答了 "1" 的兔子可能有相同的颜色,设为红色。
+两只回答了 "1" 的兔子可能有相同的颜色,设为红色。
之后回答了 "2" 的兔子不会是红色,否则他们的回答会相互矛盾。
-设回答了 "2" 的兔子为蓝色。
-此外,森林中还应有另外 2 只蓝色兔子的回答没有包含在数组中。
+设回答了 "2" 的兔子为蓝色。
+此外,森林中还应有另外 2 只蓝色兔子的回答没有包含在数组中。
因此森林中兔子的最少数量是 5 只:3 只回答的和 2 只没有回答的。
@@ -159,4 +159,52 @@ function numRabbits(answers: number[]): number {
+### Solution 2: Greedy + Hash Map
+
+
+
+#### TypeScript
+
+```ts
+function numRabbits(answers: number[]): number {
+ const cnt: Record = {};
+ let ans = 0;
+
+ for (const x of answers) {
+ if (cnt[x]) {
+ cnt[x]--;
+ } else {
+ cnt[x] = x;
+ ans += x + 1;
+ }
+ }
+
+ return ans;
+}
+```
+
+#### JavaScript
+
+```js
+function numRabbits(answers) {
+ const cnt = {};
+ let ans = 0;
+
+ for (const x of answers) {
+ if (cnt[x]) {
+ cnt[x]--;
+ } else {
+ cnt[x] = x;
+ ans += x + 1;
+ }
+ }
+
+ return ans;
+}
+```
+
+
+
+
+
diff --git a/solution/0700-0799/0781.Rabbits in Forest/README_EN.md b/solution/0700-0799/0781.Rabbits in Forest/README_EN.md
index 64c4163676514..b59b36d70b1a3 100644
--- a/solution/0700-0799/0781.Rabbits in Forest/README_EN.md
+++ b/solution/0700-0799/0781.Rabbits in Forest/README_EN.md
@@ -157,4 +157,54 @@ function numRabbits(answers: number[]): number {
+
+
+### Solution 2: Greedy + Hash Map
+
+
+
+#### TypeScript
+
+```ts
+function numRabbits(answers: number[]): number {
+ const cnt: Record = {};
+ let ans = 0;
+
+ for (const x of answers) {
+ if (cnt[x]) {
+ cnt[x]--;
+ } else {
+ cnt[x] = x;
+ ans += x + 1;
+ }
+ }
+
+ return ans;
+}
+```
+
+#### JavaScript
+
+```js
+function numRabbits(answers) {
+ const cnt = {};
+ let ans = 0;
+
+ for (const x of answers) {
+ if (cnt[x]) {
+ cnt[x]--;
+ } else {
+ cnt[x] = x;
+ ans += x + 1;
+ }
+ }
+
+ return ans;
+}
+```
+
+
+
+
+
diff --git a/solution/0700-0799/0781.Rabbits in Forest/Solution2.js b/solution/0700-0799/0781.Rabbits in Forest/Solution2.js
new file mode 100644
index 0000000000000..24214b0b9c71a
--- /dev/null
+++ b/solution/0700-0799/0781.Rabbits in Forest/Solution2.js
@@ -0,0 +1,15 @@
+function numRabbits(answers) {
+ const cnt = {};
+ let ans = 0;
+
+ for (const x of answers) {
+ if (cnt[x]) {
+ cnt[x]--;
+ } else {
+ cnt[x] = x;
+ ans += x + 1;
+ }
+ }
+
+ return ans;
+}
diff --git a/solution/0700-0799/0781.Rabbits in Forest/Solution2.ts b/solution/0700-0799/0781.Rabbits in Forest/Solution2.ts
new file mode 100644
index 0000000000000..a87ad1d96eecd
--- /dev/null
+++ b/solution/0700-0799/0781.Rabbits in Forest/Solution2.ts
@@ -0,0 +1,15 @@
+function numRabbits(answers: number[]): number {
+ const cnt: Record = {};
+ let ans = 0;
+
+ for (const x of answers) {
+ if (cnt[x]) {
+ cnt[x]--;
+ } else {
+ cnt[x] = x;
+ ans += x + 1;
+ }
+ }
+
+ return ans;
+}