Connect N
Asked at Airbnb· Screen
Reported by the problem's creator, not verified
Build ConnectN(rows, cols, n), the engine of a Connect Four style game on an empty rows by cols board. Players drop pieces into columns, and each piece falls to the lowest empty cell of its column. Players may move in any order, and the game does not stop after a win: later moves are still played and judged the same way. Moves are only given for columns that are not full.
Each test builds one ConnectN and checks every return value.
Examples
Example 1
Input: init =
[4,4,3], operations =[["move",[0,1]],["move",[1,2]],["move",[0,1]],["move",[1,2]],["move",[0,1]]]Output:
[false,false,false,false,true]Explanation: Player 1 drops into column 0 on moves 1, 3 and 5 while player 2 answers in column 1. Only the fifth move completes three in a column, so it is the only
True.