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)/移除字符串中的尾随零 [remove-trailing-zeros-from-a-string].html
2023-06-02 01:00:40 +08:00

28 lines
873 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>num</code> ,请你以字符串形式返回不含尾随零的整数<em> </em><code>num</code><em> </em></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>num = "51230100"
<strong>输出:</strong>"512301"
<strong>解释:</strong>整数 "51230100" 有 2 个尾随零,移除并返回整数 "512301" 。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>num = "123"
<strong>输出:</strong>"123"
<strong>解释:</strong>整数 "123" 不含尾随零,返回整数 "123" 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= num.length &lt;= 1000</code></li>
<li><code>num</code> 仅由数字 <code>0</code><code>9</code> 组成</li>
<li><code>num</code> 不含前导零</li>
</ul>