← All problemsSign in

Tony and String Queries

Today, Tony is facing yet another problem on strings with queries. He has a grid containing lowercase english characters with $n$ rows and $m$ columns. Now Tony has to answer $q$ queries in which he is given coordinates of a point on grid $(r, c)$ with a string $s$. This point is actually the top left corner of a square of area $A$. Tony needs to find the minimum area $A$ of this square such that

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