Company: Trade desk_6aug
Difficulty: medium
Draw Figures on Grid Paper Problem Description You have a sheet of grid paper with n rows and m columns, and you want to draw a block design on it, similar to Tetris pieces. Five types of figure are available. Each is shown below as a small 0/1 matrix, where 1 marks a filled cell: A : [[1]] (a single cell) B : [[1, 1, 1]] (three cells in a row) C : [[1, 1], [1, 1]] (a 2 x 2 square) D : [[1, 0], [1, 1], [1, 0]] (a vertical bar of three cells with one extra cell sticking out to the right of the middle) E : [[0, 1, 0], [1, 1, 1]] (a horizontal bar of three cells with one extra cell sticking up above the middle) You are given the letters of the figures to draw, in order, as the array figures . Draw them on the paper using these rules: The paper starts as a matrix of all 0 s. Figure number i (1-based: the first letter in figures is figure 1 ) is drawn by writing the number i into every filled cell of its shape. The 0 cells of a shape are not part of the figure and are left untouched. Figure