More efficient solution needed for Funky Chess Board

I have explained logic through comments. I am getting TLE. I have used kind of a brute force solution. How can i improve it to avoid TLE?

@Aditya.Jethliya


check out this code
using backtracking

1 Like

wow thanks! I had not thought that you could modify the original matrix. I was keeping track of previous moves by storing them in a vector and then searching through them. That probably caused TLE.

@Aditya.Jethliya
please mark your doubt as resolved :slight_smile: