Array And Simple Queries Hackerrank Solution