- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

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

Given A x B Chessboard, the task is to calculate the Maximum numbers of cuts that we can build in the Chessboard so that the Chessboard is not divided into 2 parts.

**Examples **

The examples are given below −

**Input **

A = 2, B = 4

**Output **

Number of maximum cuts = 3

**Input **

A = 2, B = 2

**Output **

Number of maximum cuts = 1

For A = 2, B = 2 ,we can only build 1 cut (mark in red). If we build 1 more cut then the chessboard will divide into 2 pieces

For A = 2, B = 4 ,we can makes 3 cuts (marks in red). If we build 1 more cut then the chessboard will divide into 2 pieces.

As a result of this, it can be observed that no. of cuts = (A-1) * (B-1).

//This is C++ implementation of above approach #include <bits/stdc++.h> using namespace std; // function that calculates the maximum no. of cuts int numberOfCuts1(int A, int B){ int result1 = 0; result1 = (A - 1) * (B - 1); return result1; } // Driver Code int main(){ int A = 4, B = 4; // Calling function. int Cuts = numberOfCuts1(A, B); cout << "Maximum cuts = " << Cuts; return 0; }

Maximum cuts = 9

- Related Questions & Answers
- Minimum Cuts can be made in the Chessboard such that it is not divided into 2 parts in Python
- Is pizza healthy? If not, can it be made healthy?
- Possible cuts of a number such that maximum parts are divisible by 3 in C++
- Check if an array of 1s and 2s can be divided into 2 parts with equal sum in Python
- Check if array can be divided into two sub-arrays such that their absolute difference is Ks in Python
- Check if any square (with one colored cell) can be divided into two equal parts in Python
- Maximum bishops that can be placed on N*N chessboard in C++
- Maximum elements that can be made equal with k updates in C++
- Place k elements such that minimum distance is maximized in C++
- Find if array can be divided into two subarrays of equal sum in C++
- Can array be divided into n partitions with equal sums in JavaScript
- Find the number of ways to divide number into four parts such that a = c and b = d in C++
- Print all possible strings that can be made by placing spaces in C++
- Find alphabetical order such that words can be considered sorted in C++
- Pick points from array such that minimum distance is maximized in C++

Advertisements