Class Solution
- java.lang.Object
-
- g2701_2800.s2710_remove_trailing_zeros_from_a_string.Solution
-
public class Solution extends Object
2710 - Remove Trailing Zeros From a String.Easy
Given a positive integer
numrepresented as a string, return the integernumwithout trailing zeros as a string.Example 1:
Input: num = “51230100”
Output: “512301”
Explanation: Integer “51230100” has 2 trailing zeros, we remove them and return integer “512301”.
Example 2:
Input: num = “123”
Output: “123”
Explanation: Integer “123” has no trailing zeros, we return integer “123”.
Constraints:
1 <= num.length <= 1000numconsists of only digits.numdoesn’t have any leading zeros.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-