The title
If a decimal number does not contain any leading zeros and each digit is either a 0 or a 1, it is a ten-binary number. For example, 101 and 1100 are both 10-binary numbers, while 112 and 3001 are not.
Given a string n representing a decimal integer, return the minimum number of 10-binary numbers that sum to n.
Example 1: Input: n = "32" Output: 3 Description: 10 + 11 + 11 = 32 Example 2: Input: n = "82734" Output: 8 Example 3: Input: n = "27346209830709182346" Output: 9Copy the code
Tip:
1 <= n.length <= 105 n consists only of digits n does not contain any leading zeros and always represents a positive integer
Their thinking
class Solution:
def minPartitions(self, n: str) -> int:
return str(max(n))
if __name__ == '__main__':
n = "32"
n = "27346209830709182346"
ret = Solution().minPartitions(n)
print(ret)
Copy the code