you give m x n binary matrix grid cell 0 1 occupiedyou give stamp size stampheight x stampwidth we want fit stamp follow give restriction requirementsCover cellsDo cover occupy cellsWe stamp wantstamp overlap otherstamp allow rotatedstamp stay completely inside gridReturn true possible fit stamp follow give restriction requirement otherwise return false example 1input grid 10001000100010001000 stampheight 4 stampwidth 3output trueexplanation we overlap stamp label 1 2 image able cover cellsexample 2input grid 1000010000100001 stampheight 2 stampwidth 2 output false Explanation there way fit stamp cell stamp go outside grid Constraintsm gridlengthn gridrlength1 m n 1051 m n 2 105gridrc 0 11 stampheight stampwidth 105