Failing perf tests 4,5

I had earlier used a 2D array to mark visited nodes but that submission failed 4 performance tests. So I checked out the approach video for a better approach and marked visited nodes using the board itself, but even that approach failed 3 performance tests. In my last submission, I passed the board and the word by reference instead of by value, but even that is failing 2 performance tests. What other optimization can I make to my code?

Check whether given string value is greater than the board size and if this is the case then directly return false since it’s not possible to have this word in board @profgrammer

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.