Answer: BHARATPE Off-Campus OA (2021) | Minimum Sum of Four Digit Number After Splitting
Answer · Posted Jun 2026
Approach Extract all 4 digits from the number. Sort the digits in ascending order. To minimize the total sum: Place smaller digits in higher place values. Form two numbers: First = smallest + third smallest Second = second smallest + largest Return their sum. Strategy Sorting guarantees optimal digit arrangement. Since there are only 4 digits, the solution is straightforward. Greedy placement of smaller digits in the tens place minimizes the final sum. Java Code: import java.util.Arrays; class Solution { ...
The full answer & interview discussion are available to premium members.
Log in Create a free account