Practice Remove Trailing Zeros From a String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given a positive integer num represented as a string, return the integer num without trailing zeros as a string.
Source: Remove Trailing Zeros From a String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = "51230100"
Output
"512301"
# Example 2
Input
num = "123"
Output
"123"
Constraints
1 <= num.length <= 1000
num consists of only digits.
num doesn't have any leading zeros.
Related LeetCode Problems
Practice more problems similar to Remove Trailing Zeros From a String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.