- 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
Minimum Cuts can be made in the Chessboard such that it is not divided into 2 parts in Python
Suppose we have one A x B chessboard (matrix), we have to calculate the maximum numbers of cuts that we can make in this board so that the board is not divided into 2 parts.
So, if the input is like A = 2 and B = 4,
then the output will be 3
To solve this, we will follow these steps −
- res := 0
- res :=(M - 1) *(N - 1)
- return res
Example
Let us see the following implementation to get better understanding −
def max_cuts_count(M, N): res = 0 res = (M - 1) * (N - 1) return res M, N = 2, 4 Cuts = max_cuts_count(M, N) print(Cuts)
Input:
2,4
Output
3
Advertisements