- Related Questions & Answers
- Number of Equivalent Domino Pairs in Python
- Vertex Covering
- Line/Edge Covering
- Domino and Tromino Tiling in C++
- Minimum Cost to cut a board into squares in Python
- Battleships in a Board in C++
- Python program to print check board pattern of n*n using numpy
- Smallest Range Covering Elements from K Lists in C++
- Finding the line covering number of a graph
- Program to find next board position after sliding the given direction once in Python
- Program to check whether a board is valid N queens solution or not in python
- Minimum Cost to cut a board into squares in C++
- Program to find the percentage of places where knight can move and not left the board in Python
- SAT – The Undergraduate College Admissions Test by the College Board
- How did Mercedes Fleet-board Technology brings the First all-electric Truck?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

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 −

- t := n * m
- return quotient of (t / 2)

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))

5,3

7

Advertisements