2023-12-09 18:42:21 +08:00
|
|
|
|
<p>给你两个二进制字符串 <code>a</code> 和 <code>b</code> ,以二进制字符串的形式返回它们的和。</p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p><strong>示例 1:</strong></p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>a = "11", b = "1"
|
|
|
|
|
<strong>输出:</strong>"100"</pre>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<p><strong>示例 2:</strong></p>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<pre>
|
|
|
|
|
<strong>输入:</strong>a = "1010", b = "1011"
|
|
|
|
|
<strong>输出:</strong>"10101"</pre>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
|
|
|
|
|
|
<ul>
|
2023-12-09 18:42:21 +08:00
|
|
|
|
<li><code>1 <= a.length, b.length <= 10<sup>4</sup></code></li>
|
|
|
|
|
<li><code>a</code> 和 <code>b</code> 仅由字符 <code>'0'</code> 或 <code>'1'</code> 组成</li>
|
|
|
|
|
<li>字符串如果不是 <code>"0"</code> ,就不含前导零</li>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
</ul>
|