#1689
Partitioning Into Minimum Number Of Deci-Binary Numbers
pupil · 410 · lc medium +25 · verified · 90.4% accepted · 2,814 likes · top 100%
Description
A deci-binary number uses only the digits 0 and 1 with no leading zeros. Given a string n representing a positive integer, return the minimum number of positive deci-binary numbers that add up to n.
Example 1:
Input: n = "32"
Output: 3
Explanation: 10 + 11 + 11 = 32
Example 2:
Input: n = "82734"
Output: 8
Example 3:
Input: n = "27346209830709182346"
Output: 9
Code
1
2
3