<p>A decimal number is called <strong>deci-binary</strong> if each of its digits is either <code>0</code> or <code>1</code> without any leading zeros. For example, <code>101</code> and <code>1100</code> are <strong>deci-binary</strong>, while <code>112</code> and <code>3001</code> are not.</p>

<p>Given a string <code>n</code> that represents a positive decimal integer, return <em>the <strong>minimum</strong> number of positive <strong>deci-binary</strong> numbers needed so that they sum up to </em><code>n</code><em>.</em></p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> n = &quot;32&quot;
<strong>Output:</strong> 3
<strong>Explanation:</strong> 10 + 11 + 11 = 32
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> n = &quot;82734&quot;
<strong>Output:</strong> 8
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> n = &quot;27346209830709182346&quot;
<strong>Output:</strong> 9
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n.length &lt;= 10<sup>5</sup></code></li>
	<li><code>n</code> consists of only digits.</li>
	<li><code>n</code> does not contain any leading zeros and represents a positive integer.</li>
</ul>

"""
U:
What is the scope? [1,10^5]
    - We do not need to worry about null input
    - We need to be time sensitive as there may be large input

M: 

T:
Input: n = "32"
Output: 3
Explanation: 10 + 11 + 11 = 32

1. we see the 10's digit it a 3, so we will need 3 1's in the 10's place for our binary
breakdown
2. now in the 1's place we have 2, so we will need 2 ones in the 2's place
- so far, we can see that for cases where the most significant place is the highest value
in the string of numbers, we just return the most significant digit

Example 3:

Input: n = "27346209830709182346"
Output: 9

1. start with 2, we will need at least 2 1's at that significancy level
- 10000000000000000000 + 10000000000000000000
2. next we have 7, we will need at least 7 1's in that level
- 11000000000000000000 + 11000000000000000000 + 01000000000000000000 + 01000000000000000000 ...
3. next we have 3, we will need 3 1's in that level

P:
1. run through the string of digits and return the largest one.


"""

class Solution:
    def minPartitions(self, n: str) -> int:
        # max = 1 # even if our n is 0, we still need one deci-binary num to represent it
        for i in range(9,0,-1):
            if str(i) in n:
                return i
        return 1 # catches our edge case of n = 0

        
32