← All problemsSign in

NY Grid

There is a grid of N rows and M columns. You want to fill the grid with letters of two types: 'N' and 'Y'. Two letters of a same type are considered to be connected if their cells share a side (sharing only a corner does not count). A component is a maximal set of connected letters. It is not allowed to have a component of 3 or more letters. Two ways of filling are considered different if at lea

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