#3747

Count Distinct Integers After Removing Zeros

medium · 22.4% accepted · 117 likes · top 2%

math · dynamic programming

Description

You are given a positive integer n.

For every integer x from 1 to n, we write down the integer obtained by removing all zeros from the decimal representation of x.

Return an integer denoting the number of distinct integers written down.

Solution