From c91fd30c5b07beb5a2048fa65683d9b4269838ca Mon Sep 17 00:00:00 2001 From: shintaroyoshida20 Date: Sat, 7 Jun 2025 14:37:35 +0900 Subject: [PATCH] feat : #31 add the STEP1 --- blind75/binary/sum-of-two-integers/answer.md | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 blind75/binary/sum-of-two-integers/answer.md diff --git a/blind75/binary/sum-of-two-integers/answer.md b/blind75/binary/sum-of-two-integers/answer.md new file mode 100644 index 0000000..e2b2d81 --- /dev/null +++ b/blind75/binary/sum-of-two-integers/answer.md @@ -0,0 +1,58 @@ +# Title + +## STEP1 + +### 発想 + +### 想定されるユースケース + +### 何が分からなかったか? + +```javascript +const getSum = function(a, b) { + const except_carry = a ^ b + const carry = (a & b) << 1 + return except_carry + carry +}; +``` + +```javascript +// a is positive +// b is positiveの時 +const getSum = function(a, b) { + while (b !== 0) { + const sum_without_carry = a ^ b + const carry = (a & b) << 1 + a = sum_without_carry + b = carry + } + return a +}; +``` + +## STEP2 + +```javascript +``` + +## STEP3 + +```javascript +``` + +## 感想 + +### コメント集を読んで + +## 他の人のPRを読んで + +## その他の方法 + +### コードの良し悪し + +* `*0` + +* `*1` + +## 調べたこと +