A is NxM matrix. 0 indicates empty plot, 1 indicates house.
We need to place a store in a neighborhood.
The store must be max K distance from each house.
The Store must be placed at an empty plot.
How many suitable locations are present?
Test Cases
[
{
input: {
K: 2,
A: [
[0, 0, 0, 0],
[0, 0, 1, 0],
[1, 0, 0, 1],
],
},
output: 2,
},
{
input: {
K: 1,
A: [
[0, 1],
[0, 0],
],
},
output: 2,
},
{
input: {
K: 4,
A: [
[0, 0, 0, 1],
[0, 1, 0, 0],
[0, 0, 1, 0],
[1, 0, 0, 0],
[0, 0, 0, 0],
],
},
output: 8,
},
]
write a function in c++:
int solution(int K, vector< vector > &A);
Answers
Answered by
0
Answer:
Pls write the question correctly then it will be easy for us to answer you and in this the question is mixed up so it is very hard to understand so pls clear this question then it will be easy.
Explanation:
Hope you got that.
Similar questions