Hackerrank – Funny String

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

Solution
For index i in string s check if all differences are equals:

    \[|s_{i} - s_{i+1}| - |s_{length(s)-i-2} - s_{length(s)-i-1}|\]

I created solution in:

All solutions are also available on my GitHub.

Java

JavaScript

Scala

Ruby