FastPrepAssign Sequential Loan Identifiers
Problems/Assign Sequential Loan Identifiers

Assign Sequential Loan Identifiers

Affirm logoAffirm● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report keeps the idea of giving each transaction a loan ID. It leaves out the ID rule, the transaction format, how to group, the output format and the limits. We used the simplest fixed rule: consecutive IDs starting at one, in input order.

Each string in transactionRefs is one transaction, listed in order. Give every transaction a loan identifier.

Go from left to right. The transaction at index i gets identifier i + 1. Repeated reference strings are still separate transactions, so every transaction gets its own identifier.

Return the identifiers in the same order as the transactions.

Function

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

Examples

Example 1

transactionRefs = ["txn-a","txn-b","txn-c","txn-d"]return = [1,2,3,4]

Going left to right, txn-a gets identifier one, txn-b gets two, txn-c gets three and txn-d gets four. The answer lists them in that order: one, two, three, four.

Example 2

transactionRefs = ["retry","retry","settled"]return = [1,2,3]

The first two transactions have the same reference, retry, but they are still separate transactions. They get identifiers one and two. The settled transaction gets three. The answer is one, two, three.

Example 3

transactionRefs = ["only-transaction"]return = [1]

There is only one transaction, so it gets identifier 1. The answer holds just that one identifier.

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.

More Affirm interview questions

  • Propagating Fraud DetectorPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Cross-Day User Trust ScoresPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Count Distinct Underwriting PII ValuesPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • High-Card Pot GamePHONE SCREEN · Seen Sep 2026
  • Normalize Loan Merchants to Root BusinessesPHONE SCREEN · Seen Sep 2026
  • Redeemable Promotion OffersPHONE SCREEN · Seen Aug 2026
  • Group Loans by Top-Level Parent CompanyPHONE SCREEN · Seen Aug 2026
  • Group Transactions by HourONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Lazy Filter over a GeneratorSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Array-Backed Set Without Library CollectionsOde with Anthropic · PHONE SCREEN
  • Paginate Retained Conversation HistorySierra · PHONE SCREENSierra interview questions
  • Validate a Chess Bishop, Rook, or Queen MoveGlean · PHONE SCREENGlean interview questions
  • Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Bounded IPv4 FilterAmazon · PHONE SCREEN
  • Partition and Group Values by ParityEPAM · PHONE SCREENEPAM interview questions

Affirm interview experiences

  • Affirm SWE Virtual Onsite with AI Coding: 1 Experience
  • Affirm Staff SWE Virtual Onsite: 1 Experience
  • Affirm New Grad Frontend Interviews: 1 Experience
All Affirm interview questionsSee Affirm hiring insights
Saved
class Solution {
    public int[] assignLoanIds(String[] transactionRefs) {
      // Write your code here.
    }

}
Checking account…