Problem Brief
The Three Knights π
INTERNOA
See Tiktok online assessment and hiring insights
Given a grid with n rows and m columns, count the number of possible placements for three knights on the grid such that no two knights' placements counter each other. Note that no two knights can be placed in the same cell.
It is known that a knight in chess can counter another piece in cell (a2, b2) from the cell (a1, y1) if either (|a1 - a2| = 1 and |b1 - b2| = 2), or (|a1 - a2| = 2 and |b1 - b2| = 1).
Find the number of possible placements for the three knights on the grid such that no two knights can counter each other.
1Example 1
Input
n = 2, m = 3
Output
20
Explanation
There are 20 possible placements for the three knights.
(That is all for now) ππ₯Ήπ
Constraints
Limits and guarantees your solution can rely on.
Unknown myth for now π¦ (As always, will add once find out)