Array Mathematics Hackerrank Solution Cpp