Reported September 2024
Bloombergsliding window

Consecutive

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

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

Bloomberg's Consecutive problem landed in September 2024 and it's a sliding-window classic. You're looking at a string or array and need to find a contiguous substring or subarray that meets some condition, likely involving character counts or numeric sums. The trick is that you don't iterate from scratch at every position. Instead you maintain a window, shrink it when the condition breaks, and expand it as you go. StealthCoder can handle the implementation if you freeze mid-problem, but knowing the window pattern now means you won't need the hedge.

Pattern and pitfall

Sliding window is Bloomberg's bread and butter. The pattern works like this: initialize two pointers at the start, expand the right pointer to pull in new elements, track state in a hash map or counter, then shrink from the left when you violate the constraint. The common pitfall is forgetting to update your tracking data structure when you move the left pointer. Another trap is off-by-one errors in the answer calculation, especially if the problem asks for the longest/shortest valid window. BloombergInterviews often test whether you can identify when to shrink, not just when to expand. If you blank on the exact shrinking logic during the live OA, StealthCoder reads the problem fresh and suggests the contraction step.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Consecutive 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. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as longest substring without repeating characters. If you have time before the OA, drill that.

⏵ The honest play

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

Bloomberg reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Consecutive FAQ

Is this really just finding the longest substring with no repeats?+

Not always. Consecutive could ask for a window where all characters appear exactly K times, or a subarray with sum less than X. The name 'consecutive' hints at contiguous, not necessarily unique. Check the exact constraint in the problem statement first.

Do I need a hash table or is an array counter enough?+

If the input is lowercase letters only, a size-26 array is faster. If it's Unicode or mixed case, hash table is safer. Bloomberg usually keeps the character set bounded, so array often wins. Just be explicit about what you're tracking.

How do I know when to shrink the window?+

Shrink when the window violates the constraint, not before. Track your constraint inside the loop. For example, if you need 'no character appears more than twice,' shrink when any character count exceeds 2. This happens in the inner while loop, not the outer for loop.

Will I have time to code this in 45 minutes with the rest of the assessment?+

Sliding window is usually 20-25 minutes if you know the pattern. The risk is overthinking the constraint. Write the two-pointer skeleton first, verify the shrink condition on paper, then code it. That order saves time.

Is this still being asked in 2024, or has Bloomberg moved on?+

September 2024 confirms it's still live. Sliding window is canonical for substring/subarray problems and Bloomberg rotates through the same patterns. It's not going anywhere. Master the template now.

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

OA at Bloomberg?
Invisible during screen share
Get it