I am getting confused while solving this problem, unlike the normal here we have n(height)xm(breadth) so if we try to place a tile of 1xm
. How is it possible to place a tile like mx1
.
Can someone please help me by explaining this problem?
Hello @raghav6,
- The area that needs to be tilled is n x m.
- The tile has the dimension: 1 x m.
…You can place tiles either horizontally or vertically:
2.1. When placed horizontally i.e. 1 x m,
… it will cover one entire row.
2.2. When placed vertically i.e. m x 1,
… it will cover one column and m rows of the area.
So, you need m such vertical tiles to cover m columns and m rows.
Try to relate it with the Tilling Problem video as explained by Sir.
BTW, you might get TLE after writing your code though it would be logically correct.
This is because it is a problem of Dynamic Programming.
But, i would highly suggest you to write the recursive code for it to understand the concept.
Hope, this would help.
Give a like if you are satisfied.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.