Problem 58. Tic Tac Toe FTW

Created by Cody Team in Community

Given a tic tac toe board:

  • 1 represents X
  • 0 represents empty.
  • -1 represents O

It is X's move. If there is an immediate win possibility, choose a square for an immediate win. Otherwise return 0.

Return absolute index of the square of choice. If multiple square are valid, return them in order.


 Input  a = [ 1  0  1
             -1  1  0
              0 -1 -1]
 Output wins is [3 4]

Solution Stats

38.67% Correct | 61.33% Incorrect
Last solution submitted on Mar 22, 2019

Problem Comments

Solution Comments

Recent Solvers474

Suggested Problems

More from this Author95

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!