1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +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 Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你两个二进制字符串 <code>a</code><code>b</code> ,以二进制字符串的形式返回它们的和。</p>
<p>&nbsp;</p>
<p><strong>示例&nbsp;1</strong></p>
<pre>
<strong>输入:</strong>a = "11", b = "1"
<strong>输出:</strong>"100"</pre>
<p><strong>示例&nbsp;2</strong></p>
<pre>
<strong>输入:</strong>a = "1010", b = "1011"
<strong>输出:</strong>"10101"</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<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>
</ul>