mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-11-12 15:25:48 +08:00
36 lines
1.0 KiB
HTML
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> </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> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= n <= 10<sup>15</sup></code></li>
|
|
</ul>
|