Rubrik | Phone Interview
Anonymous User
1929

We are given an n x m grid which contains 2 types of characters '#' and '*' . '#' indicated that a cell is occupied and '*' indicates that it is empty.

We need to output whether it would be possible to fit stamps of size a x b such that they cover all the empty cells and don't cover any of the occupied cells. We can put as many stamps as we want and the stamps can even overlap with each other.

For example:

4*4 grid
3*3 stamp

#***
#***
#***
##**

Output -> False

4*4 grid
3*3 stamp

#***
#***
#***
#***

Output -> True

9 x 7 grid
2 x 2 stamp

******#**
*****#***
****#****
***#*****
**#******
*#*******
#********

Output -> False
Comments (6)