Codeforces The Good Array Hackerrank Solution C