250x250
반응형
Notice
Recent Posts
Recent Comments
Link
목록Binary (1)
N
(Leet Code c++)Add Binary
67. Add Binary Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" Constraints: 1 = 0){ carry += b[bIndex--] == '1' ? 1 : 0; } answer = to_string(carry % 2) + answer; carry /= 2; } return answer; } };
Leet Code 알고리즘
2021. 7. 9. 10:31