Reported September 2026
Redditmatrix

Straight-Line Word Search

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

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

The Reddit OA reported in September 2026 looks like word search, but it's really a fixed-direction scan. No backtracking, no DFS, no visited set. You pick a start cell, pick one of eight directions, and walk. If you're taking this in the next day or two, that's the whole trick. The hinted pattern says binary search, but nothing here is sorted, so ignore that. The grid goes up to 200 by 200 and the word up to 200 characters, so brute force fits. If you freeze on the day, StealthCoder is the invisible safety net that reads the problem and hands you a clean solution.

The problem

Given a rectangular grid of characters and a nonempty word, return true when the word appears in one straight line.
You may start at any cell and choose one of the eight horizontal, vertical, or diagonal directions. After choosing the direction, every next character must be in the next cell along that same direction. The direction cannot change and the grid does not wrap.

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

Examples
Example 1
board = ["CAT","XXX","DOG"]
word = "CAT"
return = true
CAT appears left to right in the first row.
Example 2
board = ["AXX","XBX","XXC"]
word = "ABC"
return = true
ABC appears on the main diagonal.
Example 3
board = ["AB","CD"]
word = "ACB"
return = false
The letters require a direction change, which is forbidden.

Constraints
1 <= board.length, board[i].length <= 200.
All rows have equal length.
1 <= word.length <= 200.
The grid and word contain case-sensitive English letters.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Loop over every cell where board[r][c] equals word[0]. For each of the eight direction pairs (dr, dc), compute the end cell first: r + dr*(n-1), c + dc*(n-1). If it's out of bounds, skip that direction right away. Otherwise compare character by character along the line and return true on a full match. Cost is roughly rows * cols * 8 * word length, about 64 million character checks at the max, which is fine. The common pitfall is writing a classic DFS that lets the direction change, which makes Example 3 return true when it should be false. Another trap is a single-letter word, where all eight directions collapse to a one-cell match, so handle length 1 cleanly. Also remember matching is case-sensitive. If you blank on the bounds math during the live OA, StealthCoder is the hedge that gives you the loop structure fast.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Straight-Line 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. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Reddit reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Straight-Line Word Search FAQ

What's the trick in the Reddit Straight-Line Word Search problem?+

Fix the direction before you walk. Try every starting cell and all eight direction vectors, then check characters along that single line. There's no backtracking. The direction never changes, which is exactly why Example 3 (ACB) fails.

Is this actually a binary search problem?+

No. The hint says binary search, but the grid isn't sorted and nothing is monotonic. It's a brute-force grid scan with direction vectors. Don't force a pattern the problem doesn't have.

Will brute force pass the constraints?+

Yes. With a 200 by 200 grid, 8 directions, and a word up to 200 characters, the worst case is around 64 million comparisons. Early exits on first-letter mismatch and out-of-bounds ends make it much faster in practice.

What edge cases should I test before submitting?+

Test a one-character word, a word longer than both grid dimensions, a single-row or single-column grid, a reversed word along a row, and an anti-diagonal match. Also confirm case sensitivity, since 'a' and 'A' are different.

How do I prepare for this in 48 hours?+

Write the eight direction pairs from memory, then code the scan once with an upfront bounds check on the end cell. Run the three examples by hand. If you can do that in 15 minutes, you're ready for this Reddit question and its variants.

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

OA at Reddit?
Invisible during screen share
Get it