1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-11-12 15:25:48 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (English)/移除十进制表示中的所有零(English) [remove-zeros-in-decimal-representation].html
2025-11-11 22:54:49 +08:00

36 lines
1.0 KiB
HTML

<p>You are given a <strong>positive</strong> integer <code>n</code>.</p>
<p>Return the integer obtained by removing all zeros from the decimal representation of <code>n</code>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">n = 1020030</span></p>
<p><strong>Output:</strong> <span class="example-io">123</span></p>
<p><strong>Explanation:</strong></p>
<p>After removing all zeros from 1<strong><u>0</u></strong>2<strong><u>00</u></strong>3<strong><u>0</u></strong>, we get 123.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">n = 1</span></p>
<p><strong>Output:</strong> <span class="example-io">1</span></p>
<p><strong>Explanation:</strong></p>
<p>1 has no zero in its decimal representation. Therefore, the answer is 1.</p>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 10<sup>15</sup></code></li>
</ul>