mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
27
leetcode/problem/remove-trailing-zeros-from-a-string.html
Normal file
27
leetcode/problem/remove-trailing-zeros-from-a-string.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<p>Given a <strong>positive</strong> integer <code>num</code> represented as a string, return <em>the integer </em><code>num</code><em> without trailing zeros as a string</em>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> num = "51230100"
|
||||
<strong>Output:</strong> "512301"
|
||||
<strong>Explanation:</strong> Integer "51230100" has 2 trailing zeros, we remove them and return integer "512301".
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> num = "123"
|
||||
<strong>Output:</strong> "123"
|
||||
<strong>Explanation:</strong> Integer "123" has no trailing zeros, we return integer "123".
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= num.length <= 1000</code></li>
|
||||
<li><code>num</code> consists of only digits.</li>
|
||||
<li><code>num</code> doesn't have any leading zeros.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user