Pregunta de entrevista de Visa Inc.

Hackerrank array based question on moving up down left right.