Suppose we have two numbers n and m representing a board of size n x m. We also have an unlimited number of 1 x 2 dominos. We have to find the maximum number of dominos that can be placed on the board such that they don't overlap and every domino lies completely within the board.
So, if the input is like n = 5, m = 3, then the output will be 7
To solve this, we will follow these steps −
Let us see the following implementation to get better understanding −
class Solution: def solve(self, n, m): t = n * m return t // 2 ob = Solution() print(ob.solve(5,3))