← All problemsSign in

Grid Cake

Tom and Jerry both like a special cake called the Grid Cake. It is made of $M*N$ pieces of different cakes resembling a **2D M-by-N grid**. Out of the $M*N$ pieces of different cakes there is a piece of spaghetti cake which both hate. Both Tom and Jerry don't want that bad piece so they came up with the following way to decide who gets the bad piece: - Both of them alternatively take

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