#3270

Find the Key of the Numbers

easy · 76.5% accepted · 105 likes · top 88%

math

⊣ practice⊣ open on leetcode ↗

Description

You are given three positive integers num1, num2, and num3.

The key of num1, num2, and num3 is defined as a four-digit number such that:

- Initially, if any number has less than four digits, it is padded with leading zeros.

- The ith digit (1 <= i <= 4) of the key is generated by taking the smallest digit among the ith digits of num1, num2, and num3.

Return the key of the three numbers without leading zeros (if any).

Solution