Partitioning Into Minimum Number Of Deci-Binary Numbers

Medium · Greedy · about 5 minutes

Asked at Amazon, Google, Microsoft.

Call a positive integer *deci-binary* when each of its decimal digits is 0 or 1 (with no leading zeros). The decimal string n is to be written as a sum of deci-binary numbers. What is the smallest number of terms you need?