1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/二进制求和 [add-binary].html
2022-03-29 12:43:11 +08:00

26 lines
854 B
HTML

<p>给你两个二进制字符串,返回它们的和(用二进制表示)。</p>
<p>输入为 <strong>非空 </strong>字符串且只包含数字&nbsp;<code>1</code>&nbsp;&nbsp;<code>0</code></p>
<p>&nbsp;</p>
<p><strong>示例&nbsp;1:</strong></p>
<pre><strong>输入:</strong> a = &quot;11&quot;, b = &quot;1&quot;
<strong>输出:</strong> &quot;100&quot;</pre>
<p><strong>示例&nbsp;2:</strong></p>
<pre><strong>输入:</strong> a = &quot;1010&quot;, b = &quot;1011&quot;
<strong>输出:</strong> &quot;10101&quot;</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li>每个字符串仅由字符 <code>&#39;0&#39;</code><code>&#39;1&#39;</code> 组成。</li>
<li><code>1 &lt;= a.length, b.length &lt;= 10^4</code></li>
<li>字符串如果不是 <code>&quot;0&quot;</code> ,就都不含前导零。</li>
</ul>