Tic Tac Toe FTW - MATLAB Cody - MATLAB Central

Problem 58. Tic Tac Toe FTW

Difficulty:Rate

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.

Example:

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

Solution Stats

49.53% Correct | 50.47% Incorrect
Last Solution submitted on Feb 10, 2025

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
3
5

Problem Recent Solvers1792

Suggested Problems

More from this Author96

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page