This solution is outdated. To rescore this solution, sign in.
This is a nice problem, but the solution test suit is poor.
To get 126 for n = 3 one need to assume same player always starts.
If either player could start we get more solutions.
I.E. number of solutions with 4 x's and 5 o's + number of solutions with 5 x's and 4 o's
https://www.mathworks.com/matlabcentral/cody/problems/44851 provides a more challenging extension that asks the user to take into account that games end when there's a "win".
My first attempt at producing a community problem so thanks for the feedback on improving the test suite.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
n = 3;
y_correct = 126;
assert(isequal(xoxo(n),y_correct))
|
522 Solvers
Project Euler: Problem 2, Sum of even Fibonacci
462 Solvers
Getting the indices from a vector
1448 Solvers
21 Solvers
Rounding off numbers to n decimals
282 Solvers