Class Solution
java.lang.Object
g2701_2800.s2710_remove_trailing_zeros_from_a_string.Solution
2710 - Remove Trailing Zeros From a String.<p>Easy</p>
<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><strong>Example 1:</strong></p>
<p><strong>Input:</strong> num = “51230100”</p>
<p><strong>Output:</strong> “512301”</p>
<p><strong>Explanation:</strong> Integer “51230100” has 2 trailing zeros, we remove them and return integer “512301”.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> num = “123”</p>
<p><strong>Output:</strong> “123”</p>
<p><strong>Explanation:</strong> Integer “123” has no trailing zeros, we return integer “123”.</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>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
removeTrailingZeros
-