Design a data structure such that getWinner method runs in O(1) time.
Assume you call put(x, y, Player) for each move. Best space efficient solution wins.
|
Design a data structure such that getWinner method runs in O(1) time. Assume you call put(x, y, Player) for each move. Best space efficient solution wins. |
|||
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
PHP
|
||||
|
|
getWinnermethod code? – beary605 Sep 30 '12 at 7:20winnerfield, from enum none/naughts/crosses/draw, and keep it up-to-date after each move. Now getWinner runs un O(1), by power of the magic of underspecified problems. – J B Sep 30 '12 at 7:52