Hackerrank – Filling Jars

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
sum = (b - a + 1) * no_candies
for each operations. Average and floor the sum.

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby