
4 Attachment(s)
TicTacToe problem
Hi guys, hopefully this is an easy one for you.
Given a grid of nxn squares, where each square has an id, the first(top left) square has id 0 (so a 5x5 grid will have ids 024) like below:
Attachment 23365
I need to generate all diagonal solutions of length Y. So if Y is 3, then some of the solutions will be:
Attachment 23366
and
Attachment 23367
but obviously NOT
Attachment 23368
Any ideas how these solutions can be generated?

Re: TicTacToe problem

Re: TicTacToe problem
Wow, that makes sense. Thank you Soroban.