Absolute Difference Sum
CodeChefOpen on judge ↗
Little Sajal went to school and learned how to calculate the score of an integer. The score of an integer is defined as the sum of the absolute value of the difference of all pairs of digits in this integer. For example, the score of 214 is $|2 - 1| + |1 - 4| + |2 - 4| = 6$. As Sajal is very smart, he quickly learned it, and as an exercise, the teacher gave him a task. He will be given two intege
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start