- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Domino Covering Board in Python
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 −
Example
class Solution: def solve(self, n, m): t = n * m return t // 2 ob = Solution() print(ob.solve(5,3))
Input
5,3
Output
7
Advertisements