← All problemsSign in

Squares Counting

CodeChefRating 2465Open on judge ↗

You are given a binary square matrix $A$ of size $N \times N$. Let the value at cell $(i, j)$ be denoted by $A(i, j)$. Your task is to count the number of *square frames* present in the grid. A *square frame* is defined to be a square submatrix of $A$ whose border elements are all '1'. Formally, - A square submatrix of $A$ of size $k$ with top-left corner $(i, j)$ is defined to be the set of ce

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