commit 52925dd03ae59db213eb728c685491a8b9dea4a4
parent 9c57818fcb6211316f3e8e5a39096ff703fd6a6e
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Tue, 4 Jul 2023 10:46:50 +0200
Daily Problem
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Problems/0137.cpp b/Problems/0137.cpp
@@ -0,0 +1,11 @@
+class Solution {
+public:
+ int singleNumber(const vector<int> &nums) {
+ int mask1 = 0, mask2 = 0;
+ for (int n : nums) {
+ mask1 = (mask1 ^ n) & ~mask2;
+ mask2 = (mask2 ^ n) & ~mask1;
+ }
+ return mask1;
+ }
+};
diff --git a/README.md b/README.md
@@ -144,6 +144,7 @@ for solving problems.
| 0134 | Medium | [Gas Station](Problems/0134.cpp) |
| 0135 | Hard | [Candy](Problems/0135.cpp) |
| 0136 | Easy | [Single Number](Problems/0136.cpp) |
+| 0137 | Medium | [Single Number II](Problems/0137.cpp) |
| 0138 | Medium | [Copy List with Random Pointer](Problems/0138.cpp) |
| 0139 | Medium | [Word Break](Problems/0139.cpp) |
| 0141 | Easy | [Linked List Cycle](Problems/0141.cpp) |