<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>

class Solution:
    def minPartitions(self, n: str) -> int:
        """
        Paraphrase
            Find number of decibinary numbers that sum to n's integer rep
        Assumptions
            I should always add the largest numbers possible out of the remaining distance to n
        Constraints
            Can only add decibinary numbers
        Questions
            Wait. Wont the answer always be the largest digit in n?
        Givens
            A positive decimal integer n
        Solution
            Take the number n represents
            Find the largest decibinary possible smaller than it
            Subtract that amount from n
            Keep doing this and track the number of moves it takes to reach n

            Iterate through n and find the digit of maximum value.
            That digit is the answer
        Algorithm
            true algo
            '
                max = 0
                for char in n:
                    num = int(char)
                    max = max(max, num)
                    if max = 9:
                        return 9
                return max
            '

            int res
            list[int] numList
            make numLists length equal to n
            Iterate through n
            LOOP for each char in n:
                convert char to the integer it represents
                append that integer to numList
            LOOP while any index in numList has a value greater than 0
                For int in numList:
                    if int is greater than 0:
                        decrement int by 1
                Increment res

                

        Brainstorm
            should always find the largest decibinary number smaller than n on each step
            find largest decibinary
            subtract from n
            increment moves countj
            continue until reaching n
            because n is a string i can identify each individual digit in n on its own
            I can use the index of the digit in the string to recreate the place value of the
            actual number needed
        """

        res = 0
        for char in n:
            num = int(char)
            res = max(res, num)
            if res == 9: return 9
        return res
200