Problem Statement
Given n, return the number of distinct ways to put n X's on an n by n by n 3-D Tic Tac Toe Board such that the n X's are in a row.
The n in a row can be in a horizontal, vertical, or diagonal line.
Definition
- Class:
- TicTacToe3D
- Method:
- howMany
- Parameters:
- int
- Returns:
- int
- Method signature:
- int howMany(int n)
- (be sure your method is public)
Constraints
- n will be between 1 and 1000, inclusive.
Examples
1
Returns: 1
There is only one possible place to put the X, and it results in getting 1 in a row, so there is 1 way to get 1 in a row.
2
Returns: 28
8
Returns: 244
500
Returns: 753004
1000
Returns: 3006004
40
Returns: 5044
20
Returns: 1324
23
Returns: 1729
43
Returns: 5809
998
Returns: 2994004
456
Returns: 626548
35
Returns: 3889
543
Returns: 887809
345
Returns: 359149
341
Returns: 350893
12
Returns: 508
787
Returns: 1862833
456
Returns: 626548
745
Returns: 1669549
654
Returns: 1287076
1
Returns: 1
8
Returns: 244
3
Returns: 49
2
Returns: 28
5
Returns: 109