Validate an extended tic-tac-toe state | Snowflake Interview Question