← All problemsSign in

Giant And Candies

There is a matrix of $N$ rows and $N$ columns. On the cell top-leftmost cell there is a Giant. Let me tell you one thing about giants, they are dumb. So you have to help the Giant. The task is simple. Initially the Giant has zero candy. There are may be atmost one candy in each cell, i.e. there can be 0 or 1 candy in one cell. If Giant visits a cell having candy then he collects the candy. Also th

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start