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)/二进制求和 [JFETK5].html

32 lines
1.1 KiB
HTML

<p>给定两个 01 字符串&nbsp;<code>a</code>&nbsp;&nbsp;<code>b</code>&nbsp;,请计算它们的和,并以二进制字符串的形式输出。</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;10&quot;
<strong>输出:</strong> &quot;101&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>
<p>&nbsp;</p>
<p><meta charset="UTF-8" />注意:本题与主站 67&nbsp;题相同:<a href="https://leetcode-cn.com/problems/add-binary/">https://leetcode-cn.com/problems/add-binary/</a></p>