<p>You are given three <strong>positive</strong> integers <code>num1</code>, <code>num2</code>, and <code>num3</code>.</p>

<p>The <code>key</code> of <code>num1</code>, <code>num2</code>, and <code>num3</code> is defined as a four-digit number such that:</p>

<ul>
	<li>Initially, if any number has <strong>less than</strong> four digits, it is padded with <strong>leading zeros</strong>.</li>
	<li>The <code>i<sup>th</sup></code> digit (<code>1 &lt;= i &lt;= 4</code>) of the <code>key</code> is generated by taking the <strong>smallest</strong> digit among the <code>i<sup>th</sup></code> digits of <code>num1</code>, <code>num2</code>, and <code>num3</code>.</li>
</ul>

<p>Return the <code>key</code> of the three numbers <strong>without</strong> leading zeros (<em>if any</em>).</p>

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

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">num1 = 1, num2 = 10, num3 = 1000</span></p>

<p><strong>Output:</strong> <span class="example-io">0</span></p>

<p><strong>Explanation:</strong></p>

<p>On padding, <code>num1</code> becomes <code>&quot;0001&quot;</code>, <code>num2</code> becomes <code>&quot;0010&quot;</code>, and <code>num3</code> remains <code>&quot;1000&quot;</code>.</p>

<ul>
	<li>The <code>1<sup>st</sup></code> digit of the <code>key</code> is <code>min(0, 0, 1)</code>.</li>
	<li>The <code>2<sup>nd</sup></code> digit of the <code>key</code> is <code>min(0, 0, 0)</code>.</li>
	<li>The <code>3<sup>rd</sup></code> digit of the <code>key</code> is <code>min(0, 1, 0)</code>.</li>
	<li>The <code>4<sup>th</sup></code> digit of the <code>key</code> is <code>min(1, 0, 0)</code>.</li>
</ul>

<p>Hence, the <code>key</code> is <code>&quot;0000&quot;</code>, i.e. 0.</p>
</div>

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

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">num1 = 987, num2 = 879, num3 = 798</span></p>

<p><strong>Output:</strong> <span class="example-io">777</span></p>
</div>

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

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">num1 = 1, num2 = 2, num3 = 3</span></p>

<p><strong>Output:</strong> <span class="example-io">1</span></p>
</div>

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

<ul>
	<li><code>1 &lt;= num1, num2, num3 &lt;= 9999</code></li>
</ul>

class Solution:
    def generateKey(self, num1: int, num2: int, num3: int) -> int:
        str1 = f"{num1:04d}"  # Pad num1 with leading zeros if necessary
        str2 = f"{num2:04d}"  # Pad num2 with leading zeros if necessary
        str3 = f"{num3:04d}"  # Pad num3 with leading zeros if necessary

        # Initialize an empty key
        key = ""
        
        # Iterate through the digits and find the minimum at each position
        for i in range(4):
            smallest_digit = min(str1[i], str2[i], str3[i])
            key += smallest_digit
        
        # Return the key as an integer (removes leading zeros automatically)
        return int(key)


        """
        - find the smallest digit from each number 
        - if smallest digit is same from each number, return that smallest number 3 times
        """

        # smallDigit1 = float('inf')
        # smallDigit2 = float('inf')
        # smallDigit3 = float('inf') 

        # while num1 > 0:
        #     lastDigit = num1 % 10 
        #     if lastDigit < smallDigit1:
        #         smallDigit1 = lastDigit

        #     num1 //= 10

        # while num2 > 0:
        #     lastDigit = num2 % 10 
        #     if lastDigit < smallDigit2:
        #         smallDigit2 = lastDigit

        #     num2 //= 10

        # while num3 > 0:
        #     lastDigit = num3 % 10 
        #     if lastDigit < smallDigit3:
        #         smallDigit3 = lastDigit

        #     num3 //= 10

        # # if any of the smallDigit is 0 
        # if smallDigit1 == 0 or smallDigit2 == 0 or smallDigit3 == 0:
        #     return 0 

        # elif smallDigit1 == smallDigit2 == smallDigit3:
        #     return smallDigit1*100 + smallDigit1*10 + smallDigit1 

        # return min(num1, num2, num3)  

        
34