Skip to content

Commit 4a1a356

Browse files
committed
🔥 Sum of Two Integers
1 parent 82f39af commit 4a1a356

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Solutions of LeetCode Blind 75 Problems in JavaScript
1616
| [Search in Rotated Sorted Array](./search-in-rotated-sorted-array.js) | <img src="https://img.shields.io/badge/-Medium-orange" /> | `Array`, `Binary Search` | [:link:](https://leetcode.com/problems/search-in-rotated-sorted-array/) |
1717
| [3Sum](./3sum.js) | <img src="https://img.shields.io/badge/-Medium-orange" /> | `Array`, `Two Pointers`, `Sorting` | [:link:](https://leetcode.com/problems/3sum/) |
1818
| [Container With Most Water](./container-with-most-water.js) | <img src="https://img.shields.io/badge/-Medium-orange" /> | `Array`, `Two Pointers`, `Greedy` | [:link:](https://leetcode.com/problems/container-with-most-water/) |
19+
| [Sum of Two Integers](./sum-of-two-integers.js) | <img src="https://img.shields.io/badge/-Medium-orange" /> | `Math`, `Bit Manipulation` | [:link:](https://leetcode.com/problems/sum-of-two-integers/) |

sum-of-two-integers.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const getSum = (a, b) => {
2+
let carry;
3+
4+
while (b) {
5+
carry = a & b;
6+
a ^= b;
7+
b = carry << 1;
8+
}
9+
10+
return a;
11+
};

0 commit comments

Comments
 (0)