Reported February 2026
Wells Fargohash table

Count Server Replacements

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

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

The mistake that sinks a first attempt on this Wells Fargo OA, reported in February 2026, is using one global error counter instead of one per server. Count Server Replacements looks trivial, and it is, but the interleaved logs trip people up. Server s1 errors, then s2 errors, then s1 errors again, and the streak for s1 is still alive. You need a hash map of consecutive error counts keyed by server ID. If you blank under the clock, StealthCoder is the invisible hedge running on your screen during the live assessment.

The problem

You have n servers with IDs "s1", "s2",..., "sn". The system processes a sequence of log entries, where each entry is formatted as:
"<server_id> <status>", where status is either "success" or "error"
For each server, track its consecutive errors:
If a server records three "error" logs in a row, it is considered faulty and is replaced. The replacement server keeps the same ID.
After a replacement, that server's consecutive error count resets to 0.
A "success" log also resets that server's consecutive error count to 0.
Your task is to determine the total number of server replacements that occur while processing all log entries.

Function
countServerReplacements(n: int, logs: String[]) → int

Examples
Example 1
n = 2
logs = ["s1 error", "s1 error", "s2 error", "s1 error", "s1 error", "s2 success"]
return = 1

Reported by candidates. Source: FastPrep

Pattern and pitfall

This is a hash-table simulation, one pass over the logs. Keep a map from server ID to its current consecutive error count. For each log, split on the space. If the status is "error", increment that server's count. When it hits 3, add one to the replacement total and reset that count to 0. If the status is "success", reset the count to 0. Walk through Example 1 and you get exactly one replacement: s1 hits three errors at its fourth log, and s2 never gets there. The pitfalls are a shared counter across servers, forgetting to reset after a replacement (so the fourth error counts as another), and not resetting on success. Time is O(m) for m logs, space is O(n). Ignore n for the logic, since the map handles unseen IDs fine. StealthCoder is the safety net on the live OA if the loop logic slips under pressure, but the solution is short enough to write cold.

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 Count Server Replacements 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 Wells Fargo's OA.

Wells Fargo 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.

Count Server Replacements FAQ

How hard is Count Server Replacements really?+

Easy. It's a single pass with a hash map of counters. The difficulty is only in tracking state per server instead of globally and resetting correctly. If you can write a word-frequency counter, you can write this in a few minutes.

What's the trick to getting it right?+

Keep one consecutive error count per server ID. On error, increment. At three, bump the replacement total and reset to zero. On success, reset to zero. Interleaved logs from different servers must never share a counter.

Does a replacement reset the streak?+

Yes. After a replacement the server keeps its ID but its count goes back to 0. So six errors in a row produce two replacements, not four. Forgetting this reset is the most common wrong answer.

Do I need to use n in my solution?+

Not really. A hash map keyed by ID handles any server that appears in the logs. You could preallocate n counters, but a map is simpler and avoids parsing the numeric part of the ID.

How do I prepare for this in 48 hours?+

Practice small log-parsing simulations with a hash map: split strings, update per-key state, return a total. Write this one from scratch twice, and test with interleaved servers and a streak of six errors to catch reset bugs.

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

OA at Wells Fargo?
Invisible during screen share
Get it