Not a proper solution; it would incorrectly identify x = [1 1 1; 1 1 1; 1 0 0] as a valid state.
Ignore my previous comment; I was mistaken when I wrote that (and apparently I can't delete it).
The bug with deleting comments on problems or solutions appears to be longstanding. See https://au.mathworks.com/matlabcentral/cody/problems/43708
Thanks for the link, David Verrelli. I seem to remember that the "Delete" button did work in the nottoodistantpast (a few months ago), but maybe I'm misremembering things. However, to be honest, I don't mind this bug as much because I think it's a good thing that a comment can't be deleted when it has already received replies; otherwise a thread of comments would become unreadable. It's only when an erroneous comment of mine hasn't received any replies yet and the "Delete" button turns out to be nonfunctional that I experience a slight "Aaargghh!" moment, because the presence of the "Delete" button created different expectations. :) But I don't really mind leaving my erroneous comment up and correcting myself in a new comment, as I did above.
Yurenchu, I agree that if a comment has received replies it's generally best not to delete it.
Test  Status  Code Input and Output 

1  Pass 
x = [1 1 0
0 0 0
0 0 0];
y_correct = 0;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

2  Pass 
x = [0 0 0
0 0 0
0 0 0];
y_correct = 1;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

3  Pass 
x = [ 1 1 1
1 1 1
1 1 1];
y_correct = 0;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

4  Pass 
x = [ 0 1 1
1 1 0
1 0 0];
y_correct = 1;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

5  Pass 
x = [ 1 1 1
1 1 1
0 0 0];
y_correct = 0;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

6  Pass 
x = [1 1 1
0 1 1
1 0 1];
y_correct = 0;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

7  Pass 
x = [1 1 0
0 0 0
0 0 0];
y_correct = 1;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

8  Pass 
x = [1 0 0
0 0 0
0 0 0];
y_correct = 0;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

9  Pass 
x = [1 1 0
0 1 0
0 1 0];
y_correct = 0;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

10  Pass 
x = [1 1 1
1 1 1
1 1 1];
y_correct = 1;
assert(isequal(isLegalTicTacToeState(x),y_correct))
ans =
function_handle with value:
@(x,y)ismember(sum(M(:)),x)&~any(sum([M,M',diag(M),diag(fliplr(M))])==y)

2017 Solvers
Are all the three given point in the same line?
272 Solvers
242 Solvers
650 Solvers
215 Solvers