Implement a Connect Four variant where when a player inserts a disc into a column, the disc moves to the bottom cell of that column and pushes all existing discs in that column up by one. If the column is already full, the disc that is pushed above the top row is ejected and removed from the board. Design the board representation and APIs to:
(
-
initialize with R rows and C columns (default 6x
7),
(
-
drop a disc for a given player into a column,
(
-
detect a win (four in a row horizontally, vertically, or diagonally) after each move, and
(
-
support undo and redo of moves. Specify time and space complexities, data structures used, and how you handle edge cases such as ejected discs, invalid columns, alternating turns, and draw detection. Provide code for the core operations.