Retry with an Attempt Limit
Reported by candidates from Oracle's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Oracle reported this one in September 2026, and the title sounds scarier than the problem is. Retry with an Attempt Limit is a plain simulation. Walk the outcomes array, stop at the first SUCCESS, and cap the walk at maxAttempts. If you've got an OA invite and you're bracing for graph or DP, relax. The risk here isn't the idea, it's the small string details that cost you hidden tests. If you blank on those under the clock, StealthCoder is the invisible safety net running during the live OA.
The problem
Simulate a callable whose ordered outcomes are provided in outcomes. Each entry is either FAILURE or SUCCESS:value. Invoke outcomes from left to right, using at most maxAttempts total attempts. Stop at the first success and return SUCCESS:value|attempts. If every permitted attempt fails, return FAILED|attempts. Function retry(outcomes: String[], maxAttempts: int) → String Examples Example 1 outcomes = ["FAILURE","FAILURE","SUCCESS:ready"] maxAttempts = 3 return = "SUCCESS:ready|3" The third permitted attempt succeeds, so no later outcome is inspected. Example 2 outcomes = ["FAILURE","SUCCESS:late"] maxAttempts = 1 return = "FAILED|1" The attempt budget is exhausted before the success. Constraints 1 <= outcomes.length <= 100000. 1 <= maxAttempts <= outcomes.length. Every entry is exactly FAILURE or starts with SUCCESS:. A success value contains printable ASCII characters and may be empty.
Reported by candidates. Source: FastPrep
Pattern and pitfall
What it really reduces to: a single loop from index 0 to maxAttempts-1. At each step, check if the entry starts with SUCCESS:. If it does, return SUCCESS:value|attempts, where attempts is i+1 and the value is everything after the first 7 characters. If the loop ends with no success, return FAILED|maxAttempts. That's O(maxAttempts) time and O(1) extra space. The pitfalls are small but real. The success value can be empty, so SUCCESS: must return SUCCESS:|k. The value may contain colons or pipes, so slice by prefix length instead of splitting on a delimiter. Don't look past maxAttempts even if a success sits right after it, as Example 2 shows. The constraint maxAttempts <= outcomes.length means you never run off the end. If you freeze on the formatting during the live OA, StealthCoder can hand you the clean loop.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Retry with an Attempt Limit 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 StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Oracle's OA.
Oracle 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.
Retry with an Attempt Limit FAQ
How hard is the Oracle Retry with an Attempt Limit problem really?+
Easy. It's a single-pass simulation with no data structures beyond the input array. The difficulty is entirely in output formatting and edge cases like empty success values. If you can write a for loop and a string prefix check, you can solve it in a few minutes.
What's the trick to this problem?+
Bound the loop by maxAttempts, not by outcomes.length. Return on the first entry that starts with SUCCESS:. Attempts equals the index plus one. On failure, return FAILED with maxAttempts as the count. Nothing after the cutoff gets inspected, even if it's a success.
How do I parse the success value safely?+
Take the substring after the first 7 characters, the length of SUCCESS:. Don't split on colon, because the value can contain colons. It can also be empty or contain a pipe character. Slicing by prefix length handles all of those cases cleanly.
Is this simulation pattern still asked in OAs?+
Yes. Oracle reported it in September 2026, and simulation problems like retry logic, rate limiters, and state machines keep showing up because they test careful reading over cleverness. Expect specs with precise output formats and edge cases hidden in the constraints.
How do I prepare for this in 48 hours?+
Write the solution once from scratch and test three cases: success on the first attempt, success exactly at the limit, and a success just past the limit. Add an empty-value case. That covers nearly every hidden test. Spend the remaining time on harder patterns, since this one is quick.