Reported July 2026
Cognitivbacktracking

Word Search

Reported by candidates from Cognitiv's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Cognitiv OA. Under 2s to a working solution.
Founder's read

The Cognitiv OA reported in July 2026 is Word Search, and the tiny grid is the tell. Six by six and a word up to 15 letters means brute force over paths is fine if you prune hard. The hinted pattern says binary search, but that's a red herring. This is depth-first search with backtracking. If you've seen it before, it's a ten-minute problem. If you blank on the visited-cell cleanup, it eats your whole window. StealthCoder sits invisibly on your screen as a safety net in the live OA if your mind goes empty.

The problem

Given a rectangular character grid board and a string word, return true if word can be formed by a path through the grid. Otherwise, return false.
A path may move horizontally or vertically between adjacent cells. The same grid cell cannot be used more than once in one path.

Function
wordExists(board: char[][], word: String) → boolean

Examples
Example 1
board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]]
word = "ABCCED"
return = true
The path uses the top-row cells A, B, and C, then continues down to C, left to E, and left to D.
Example 2
board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]]
word = "ABCB"
return = false
The only adjacent B that could finish the word is the cell already used after the starting A, and a cell cannot be reused.
Example 3
board = [["A"]]
word = "A"
return = true
The single grid cell forms the complete word.

Constraints
1 <= board.length <= 6
1 <= board[i].length <= 6
Every row of board has the same length.
1 <= word.length <= 15
board and word contain only uppercase and lowercase English letters.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Loop over every cell as a possible start. From a match, run DFS to the four neighbors, advancing one letter in the word each step. Mark the current cell as used before recursing, then restore it when you return. That restore step is the backtracking, and forgetting it is the classic bug. Example 2 exists to catch it: ABCB fails because the B is already used. Check bounds and character match first, and return true the moment the index equals the word length. Cheap prunes help: bail if the word is longer than the cell count, or if letters are missing from the board. Don't reach for binary search here, nothing is sorted or monotonic. Worst case is roughly cells times 3 to the power of word length, which is fine at these limits. If you freeze mid-assessment, StealthCoder is the hedge that reads the problem and hands you the DFS.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Word Search cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as word search. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Cognitiv's OA.

Cognitiv reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Word Search FAQ

What's the trick in the Cognitiv Word Search question?+

DFS with backtracking. Try every cell as a start, recurse in four directions, mark the cell visited, then unmark it on the way back. The grid is at most 6x6, so exploring paths with early exits runs fast enough without any fancy optimization.

Is this really a binary search problem?+

No. The hint is misleading. Nothing is sorted and there's no yes/no threshold to search over. The pattern is depth-first search plus backtracking on a matrix. If you start designing a binary search, stop and switch to recursion.

How do I avoid reusing a cell?+

Either keep a visited boolean grid or temporarily overwrite the cell with a placeholder character like '#'. Restore the original letter after the recursive calls return. Overwriting saves memory and is quick to write. Forgetting the restore is the most common failure.

What edge cases should I test?+

A 1x1 board with a one-letter word, a word longer than the number of cells, and a path that needs to double back through a used cell like ABCB. Also note letters can be upper or lower case, so compare exactly.

How do I prepare for this in 48 hours?+

Write the DFS from scratch twice without looking. Focus on base cases: index equals word length returns true, out of bounds or mismatch returns false. Then trace Example 2 by hand. Once the mark and unmark loop feels automatic, you're ready.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Cognitiv.

OA at Cognitiv?
Invisible during screen share
Get it