Reported September 2026
Affirmarray

Assign Sequential Loan Identifiers

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

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

Affirm reportedly put this one in front of candidates in September 2026, and the detail that matters is the repeated reference strings. Two "retry" rows still get separate identifiers. That's the whole joke. You're handed an array of strings and asked to return 1 through n in order. It's an array problem dressed up as fintech, and the trap is overthinking it. If you've got the OA coming in a day or two, read this once, relax, and write a five-line loop. StealthCoder sits in the background as a safety net if your brain freezes on something this simple.

The problem

Assign a loan identifier to every transaction in an ordered batch.
Process transactionRefs from left to right. The transaction at index i receives identifier i + 1. Each row receives a distinct identifier; repeated reference strings are still separate transactions.
Return the assigned identifiers in the same order as the input transactions.

Function
assignLoanIds(transactionRefs: String[]) → int[]

Examples
Example 1
transactionRefs = ["txn-a","txn-b","txn-c","txn-d"]
return = [1,2,3,4]
The transactions receive consecutive identifiers in input order.
Example 2
transactionRefs = ["retry","retry","settled"]
return = [1,2,3]
Each transaction row receives its own identifier, even when reference strings repeat.
Example 3
transactionRefs = ["only-transaction"]
return = [1]
The first transaction receives identifier 1.

Constraints
1 <= transactionRefs.length <= 100000.
Every transaction reference is a nonempty string of at most 100 characters.
The returned identifiers fit in a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that there's no trick. The identifier at index i is i + 1, so the string contents are irrelevant. Allocate an int array the size of the input, fill position i with i + 1, return it. That's O(n) time and O(n) space, with n up to 100000, so nothing fancy is needed. The common pitfall is overengineering: building a hash map to dedupe reference strings, which breaks Example 2 because repeated refs must get distinct IDs. Another slip is starting at 0 instead of 1. Watch for off-by-one errors and make sure the output order matches the input order. The 32-bit constraint is a non-issue since the max value is 100000. If the assessment stress makes you second-guess a problem this plain, StealthCoder is the hedge on the live OA, reading the prompt and handing you the loop so you don't talk yourself into a hash map.

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 Assign Sequential Loan Identifiers 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 Affirm's OA.

Affirm 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.

Assign Sequential Loan Identifiers FAQ

How hard is the Affirm Assign Sequential Loan Identifiers question really?+

It's about as easy as coding questions get. Return an array where position i holds i + 1. No sorting, no hashing, no edge-case maze. The only real risk is overthinking it or starting your count at 0 instead of 1.

What's the trick to this problem?+

There isn't one. Ignore the strings entirely. The identifier depends only on the index, so a single loop that writes i + 1 into a result array solves it. Duplicates don't matter because every row gets its own ID by position.

Should I use a hash map to handle repeated reference strings?+

No. Example 2 shows two identical "retry" refs getting 1 and 2. A map keyed on the string would collapse them and give wrong output. Treat every row as a separate transaction and just use its position in the input.

What's the time and space complexity?+

Time is O(n) with one pass over the input. Space is O(n) for the returned array, which you need anyway. With up to 100000 transactions and values capped at 100000, a plain int array is fine and overflow isn't a concern.

How do I prepare for this in 48 hours?+

Don't study this one. Make sure you can write array loops cleanly in your language and return the right type. Spend your time on harder patterns like hash maps, sliding window, and graphs, since an OA usually mixes easy questions with tougher ones.

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

OA at Affirm?
Invisible during screen share
Get it