1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-27 18:50:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/二进制求和 [add-binary].html

26 lines
715 B
HTML
Raw Normal View History

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>&nbsp;</p>
2023-12-09 18:42:21 +08:00
<p><strong>示例&nbsp;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>示例&nbsp;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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
2023-12-09 18:42:21 +08:00
<li><code>1 &lt;= a.length, b.length &lt;= 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>