Problem Link:Setter: Alei ReyesTester: Triveni MahathaEditorialist: Triveni MahathaDifficulty:CAKEWALK Prerequisites:None Problem:Given N x M chessboard. Make cuts on some of the edges but don't cut the board into pieces. How many maximum such cuts can you make? Explanation:Note that we can make cuts between every two consecutive row of cells. There will be N  1. Such rows to be cut. Within a row we can make M  1 cuts. This way of cutting will make the board look like an extended E  shape structure. Refer to the figure for more understanding  So number of cuts is $(N  1) \times (M  1) $ See code below  int T = readInt(); while(T > 0) { int n = readInt(); int m = readInt(); int ans = (n  1) * (m  1); printInt(ans); } Image  Insert Image Here SOLUTION:Time Complexity:$O(1)$, per test case. Space Complexity:$O(1)$
This question is marked "community wiki".
asked 23 Apr '18, 01:02

Imagine it as a graph with answered 23 Apr '18, 19:39

I think too many example cases were given in this question. One can easily solve the question without even reading it and looking on the test cases. I did not read the question carefully and found the pattern by examining the example cases. Tried it and got ACed. answered 23 Apr '18, 21:01
