Class Solution
-
- All Implemented Interfaces:
public final class Solution3270 - Find the Key of the Numbers\.
Easy
You are given three positive integers
num1,num2, andnum3.The
keyofnum1,num2, andnum3is defined as a four-digit number such that:Initially, if any number has less than four digits, it is padded with leading zeros.
The <code>i<sup>th</sup></code> digit (
1 <= i <= 4) of thekeyis generated by taking the smallest digit among the <code>i<sup>th</sup></code> digits ofnum1,num2, andnum3.
Return the
keyof the three numbers without leading zeros (if any).Example 1:
Input: num1 = 1, num2 = 10, num3 = 1000
Output: 0
Explanation:
On padding,
num1becomes"0001",num2becomes"0010", andnum3remains"1000".The <code>1<sup>st</sup></code> digit of the
keyismin(0, 0, 1).The <code>2<sup>nd</sup></code> digit of the
keyismin(0, 0, 0).The <code>3<sup>rd</sup></code> digit of the
keyismin(0, 1, 0).The <code>4<sup>th</sup></code> digit of the
keyismin(1, 0, 0).
Hence, the
keyis"0000", i.e. 0.Example 2:
Input: num1 = 987, num2 = 879, num3 = 798
Output: 777
Example 3:
Input: num1 = 1, num2 = 2, num3 = 3
Output: 1
Constraints:
1 <= num1, num2, num3 <= 9999