Question: Tic-Tac IN JAVA Problem: Given a 3x3 grid representing a finished tic-tac-toe game, return a string declaring who won. You can use a helper method

Tic-Tac IN JAVA

Problem: Given a 3x3 grid representing a finished tic-tac-toe game, return a string declaring who won.

You can use a helper method to assist in solving this problem.

Data: The matrix will not be empty nor null. Matrices will all be 3 X 3.

Output: If x's won, return "x won!". If o's won, return "o won!". If it is a tie, return "tie!"

Sample Data

[['x','o','o'],['x','o','x'],['o','x','x']]

[['x','x','o'],['x','o','x'],['x','o','x']]

Sample Output

o won!

x won!

String go(char[][] mat)

{

// your code goes here

}

please use the given format

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!