Rubrik | Phone Interview

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-09-24Added By Anonymous
Source: Link

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.

1For example: 2 34*4 grid 43*3 stamp 5 6#*** 7#*** 8#*** 9##** 10 11Output -> False 12 134*4 grid 143*3 stamp 15 16#*** 17#*** 18#*** 19#*** 20 21Output -> True 22 239 x 7 grid 242 x 2 stamp 25 26******#** 27*****#*** 28****#**** 29***#***** 30**#****** 31*#******* 32#******** 33 34Output -> False


Comments