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)/形成三的最大倍数 [largest-multiple-of-three].html

43 lines
1.1 KiB
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>给你一个整数数组&nbsp;<code>digits</code>,你可以通过按 <strong>任意顺序</strong> 连接其中某些数字来形成 <strong>3</strong> 的倍数,请你返回所能得到的最大的 3 的倍数。</p>
<p>由于答案可能不在整数数据类型范围内,请以字符串形式返回答案。如果无法得到答案,请返回一个空字符串。返回的结果不应包含不必要的前导零。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>digits = [8,1,9]
<strong>输出:</strong>"981"
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>digits = [8,6,7,1,0]
<strong>输出:</strong>"8760"
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>digits = [1]
<strong>输出:</strong>""
</pre>
<p><strong>示例 4</strong></p>
<pre>
<strong>输入:</strong>digits = [0,0,0,0,0,0]
<strong>输出:</strong>"0"
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= digits.length &lt;= 10^4</code></li>
<li><code>0 &lt;= digits[i] &lt;= 9</code></li>
</ul>