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` + +## 調べたこと +