Reported August 2026
ByteDancearray

Match Consecutive Word Boundaries (for mle also :)

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

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

The mistake that sinks a first attempt on this ByteDance OA, reported in August 2026, is overthinking it. The hinted pattern is sliding-window, but really it's a window of size two over an array. You compare words[i] and words[i+1] on first and last characters, and you return a boolean array one shorter than the input. It's easy, which is exactly why careless bugs hurt. If you blank under the timer, StealthCoder runs invisibly on the live OA and gives you the solution as a safety net. Here's the script.

The problem

Given an array of strings words, check each consecutive pair of words to determine whether they start and end with the same character.
Return a boolean array of length words.length - 1, where the ith element is true if words[i] and words[i + 1] start with the same character and end with the same character, and false otherwise.
A solution with time complexity no worse than O(words.length * sum(words[i].length)) will fit within the execution time limit.

Function
matchConsecutiveWordBoundaries(words: String[]) → boolean[]

Examples
Example 1
words = ["abcd","abdd","da","dd"]
return = [true,false,false]
The first character of both words[0] and words[1] is a, and their last character is d, so the zeroth element of the answer is true.
The first character of words[1] is a, but the first character of words[2] is d, so the first element of the answer is false.
The last character of words[2] is a, but the last character of words[3] is d, so the second element of the answer is false.
Example 2
words = ["a","a"]
return = [true]
Both words start and end with a, so the only element of the answer is true.

Constraints
1 <= words.length
1 <= words[i].length
Every word contains only lowercase English letters.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that you never need to look inside the words. Only the first and last character of each word matter, so each pair check is O(1) and the whole thing is O(n) after reading the input. Loop i from 0 to n-2, and set result[i] to words[i][0] == words[i+1][0] and words[i][last] == words[i+1][last]. The common pitfalls are off-by-one on the output length, which must be words.length - 1, and getting the last index wrong on single-character words, where first and last are the same character. Don't compare whole words, and don't build substrings. Example 2 with ["a","a"] covers the single-character case. If you freeze on the live OA, StealthCoder is the hedge. It reads the problem on screen and hands you this loop, and the proctor can't see it. Still, you can write this in two minutes.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Match Consecutive Word Boundaries (for mle also :) 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

ByteDance reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Match Consecutive Word Boundaries (for mle also :) FAQ

How hard is Match Consecutive Word Boundaries really?+

Easy. It's a single pass with a constant-time check per pair. The difficulty is only in the details: output length of n-1 and correct last-index access. If you've written any adjacent-pair loop, you've already solved the hard part.

What's the trick to this ByteDance problem?+

Ignore the middle of each word. Only the first and last characters matter, so compare words[i][0] with words[i+1][0] and the last characters of both. That gives O(n) time and O(n) output space with no extra structures.

Is the sliding-window label accurate?+

Loosely. It's a fixed window of size two moving across the array, so you compare each element to its neighbor. You don't need a deque, counters, or any window state. A plain for loop from 0 to n-2 is enough.

What edge cases should I test?+

Test a two-word array like ["a","a"], which should return [true]. Test single-character words where first equals last. Test pairs where the first characters match but the last differ, like "abcd" and "abdd" versus "da". Confirm the output length is n-1.

How do I prepare in 48 hours for this OA?+

Practice adjacent-pair array loops and string indexing in your language of choice. Write this one from scratch twice. Then spend the remaining time on harder sliding-window and hash-map problems, since an OA usually has more than one question.

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

OA at ByteDance?
Invisible during screen share
Get it