How to count number of digits ?
The good approach will be to use log10 Time complexity O(1) Space complexity O(1) . The number of digits in an integer = the upper bound of log10(n).Example: log10(12345.0)) = > 4.091491094267951 so we have to use 4+1 Read more about Logarithm here https://janeshswift.com/ios/dsa/math/logarithms-explained/
How to count number of digits ? Read More »