O's and X's

Published by Mubashir Hassan in

Given an array containing three strings, representing the rows of an O's and X's board from top to bottom, return the row and column position of the winning move for X's. Return false if the game cannot be won.

Examples

XAndO(board = [" | | ", " |X| ", "X| | "]) ➞  [1, 3]

// Board becomes:
//    |   |
//    |X |
// X |   |

XAndO(board = ["X|X|O", "O|X| ", "X|O| "]) ➞ [3, 3]

// Board becomes:
// X|X|O
// O|X|
// X|O|

Notes

There is no 0 index for the row or column.

Watch a quick demo on how Edabit works.