Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    3726 - Remove Zeros in Decimal Representation.

    Easy

    You are given a positive integer n.

    Return the integer obtained by removing all zeros from the decimal representation of n.

    Example 1:

    Input: n = 1020030

    Output: 123

    Explanation:

    After removing all zeros from 1**<ins>0</ins>2<ins>00</ins>3<ins>0</ins>** , we get 123.

    Example 2:

    Input: n = 1

    Output: 1

    Explanation:

    1 has no zero in its decimal representation. Therefore, the answer is 1.

    Constraints:

    • <code>1 <= n <= 10<sup>15</sup></code>

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Long removeZeros(Long n)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait