Reported July 2026
Upstartstring

Increase Exclamations and Convert Periods

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

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

The Upstart OA reported in July 2026 looks like a warm-up, and that's the trap. Two string rules, one example, and it feels like a replace call. Then a period sits next to an existing exclamation run and your output is off by one. If you're taking this in the next day or two, the order of operations is the whole question. StealthCoder is there as a hedge if you blank mid-assessment, but this one is easy to nail once you see the edge case.

The problem

Transform text in two steps:
Add one additional exclamation mark to every existing consecutive run of ! characters.
Replace every period. with one exclamation mark.

Function
transformPunctuation(text: String) → String

Examples
Example 1
text = "Hello. Nice to meet you!!"
return = "Hello! Nice to meet you!!!"
The period becomes !, and the existing run !! gains one more exclamation mark.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that the two steps must not interact. If you replace periods with ! first, a period next to existing exclamation marks merges into a bigger run, and then step one adds only one mark to the merged run. That's wrong. The spec says to extend runs that existed in the original text. So do a single left-to-right pass over the original string. When you hit !, consume the whole consecutive run, emit it plus one extra !, and move on. When you hit a period, emit exactly one !. Everything else copies through. That's O(n) with a string builder. The pitfall is chained replace calls or regex that run sequentially on the modified text. Test inputs like "a.!", "!.", and ".." before you submit. If you freeze on the pass logic during the live OA, StealthCoder can give you the single-pass version as a safety net.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Increase Exclamations and Convert Periods 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 would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Upstart reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Increase Exclamations and Convert Periods FAQ

How hard is the Upstart increase exclamations problem really?+

It's easy on algorithm, tricky on spec reading. It's a linear scan with no data structures. Candidates lose points by chaining two replace operations, which merges new exclamation marks with existing runs and gives wrong output on adjacent punctuation.

What's the trick to transformPunctuation?+

Treat the original text as the source of truth. Process it in one pass. A run of ! in the original gets one extra !. Each period becomes a single !. Never let converted periods count as part of an existing run.

Why does replacing periods first fail?+

Take "a.!". Replacing the period first gives "a!!", a run of two, which then becomes three. The correct answer treats the period as one ! and the original ! as its own run, giving "a!!!"? No. Original run is one !, so it becomes !!, plus the converted one, so "a!!!" only if you count them separately. Single pass avoids the confusion.

What edge cases should I test?+

Test an empty string, text with no punctuation, a period directly before or after a ! run, consecutive periods like "..", and a string that's only exclamation marks. Each period should become exactly one !, with no run extension from it.

How do I prepare for this in 48 hours?+

Practice simple string scans where you track a run with an index or counter. Write it with a string builder, not repeated concatenation. Then hand-trace three tricky inputs. This type of problem rewards careful reading over heavy prep.

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

OA at Upstart?
Invisible during screen share
Get it