← All problemsSign in

3648. Minimum Sensors to Cover Grid

LeetCodeMathOpen on judge ↗

You are given n × m grid and an integer k. A sensor placed on cell (r, c) covers all cells whose Chebyshev distance from (r, c) is at most k. The Chebyshev distance between two cells (r1, c1) and (r2, c2) is max(|r1 - r2|,|c1 - c2|). Your task is to return the minimum number of sensors required to cover every cell of the grid. Example 1: Input: n = 5, m = 5, k = 1 Output: 4 Explanation:

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