beginner question 1. puzzle game ; problem code H1

hey i wanna know the basic logic being used to solve the question. i am trying out using for loops and arrays but not getting results…

can you provide the question link