Editorial for Chef and Tic-Tac-Toe
False. This is not an editorial for Chef and Tic-Tac-Toe.
The problem is very simple for K=1.
For K=1 :
Simply check if there exists any cell on the board which has a '.' and if it exists then the answer is **YES** else **NO**.
For K>1 :
If we encounter a '.' then we need to check 4 things.
- Check number of consecutive ‘X’ in the corresponding row®.
- Check number of consecutive ‘X’ in the corresponding column©.
- Check number of consecutive ‘X’ in the corresponding left diagnol(ld).
- Check number of consecutive ‘X’ in the corresponding right diagnol(rd).
If at any step the count of (r>=K) or (c>=K) or (ld>=K) or (rd>=K) then break and the answer is YES.
ELSE if after all steps none of the counts>=K then the answer is NO.
Here is the code for the same.
I have posted it as an answer.