← All problemsSign in

The City of Chandigarh

The city of Chandigarh is represented as a matrix of size $N*N$ and there are $M$ types of people living in this city denoting $1,2,3,..., M$. There are a total $N*N$ houses. Each $(i,j)$ represents the position of a house located on $i^{th}$ row and $j^{th}$ column and there is exactly one person of type $A[i][j]$ living in that house. So now you have to answer $Q$ queries on this beautiful

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