Hackerrank – Plus Minus

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

Solution
After reading all numbers in array, you have to filter this array according to three conditions – number greater than zero, lower then zero and equals to zero. Count the subarrays and divide by array length.

I created solution in 4 languages:

All solutions are also available on my GitHub.

Scala

Java

JavaScript

Ruby