Sum of Differences of All Pairs

Company: Visa

Difficulty: easy