Leetcode Problem 2160. Minimum Sum of Four Digit Number After Splitting Digits
2160. Minimum Sum of Four Digit Number After Splitting Digits
Leetcode Solutions
Sorting Digits Approach
Convert the integer num to a string to easily access individual digits.
Split the string into its constituent digits.
Sort the array of digits in ascending order.
Form two new numbers by pairing the first and third smallest digits for the first number, and the second and fourth smallest digits for the second number.