Sum of Imbalance Numbers of All Subarrays

Sum of Imbalance Numbers of All Subarrays - Coding Problem | K5kC