M Arrays Hackerrank Solution