In North American tech company Online Assessments, Stripe has always been uniquely different.
Unlike typical algorithm-focused companies, Stripe's OA leans heavily toward real business scenarios with lengthy problem statements, complex rules, and extensive implementation details. Often giving just one hour for a single problem, it thoroughly examines candidates' ability to decompose business logic and implement engineering solutions.
This article will systematically break down the typical model of Stripe HackerRank Online Assessment Questions through a complete real-world case, summarizing hidden patterns and stable solution approaches to help you quickly establish a clear problem-solving structure within limited time.
📋 Stripe HackerRank OA Real Question: Merchant Fraud Scoring System
The problem simulates Stripe's merchant fraud scoring system with a clear objective:
Calculate the final fraud score for each merchant based on a day's transaction records and corresponding rules, then output results sorted by merchant name in lexicographical order.
Input Structure
You'll receive three things:
transactions_list
All transaction records for the dayrules_list
A rule list that corresponds one-to-one with transactionsmerchants_list
Each merchant has a base_score initial value
Note a critically important point:
Transactions and rules strictly correspond one-to-one — this is crucial for implementation.
🎯 Overall Solution Approach
Never process this transaction-by-transaction as you read them, or the logic will become extremely chaotic.
The correct approach: Process by rule type in stages, first collect state, then settle in batches.
I would break this into five clear steps.
Step 1: Build Merchants Dictionary First
Don't rush to calculate scores. First transform merchants_list into a dictionary structure:
merchant_id -> current_score
Where current_score is initialized to base_score.
All subsequent rules apply multiplication or addition/subtraction to current_score.
Step 2: Merge Transaction and Rule Into Complete Records
Since transactions_list and rules_list correspond one-to-one, strongly recommend merging them at the start.
Each complete record should contain at least these fields:
- merchant_id
- customer_id
- amount
- hour
- min_transaction_amount
- multiplicative_factor
- additive_factor
- penalty
This way all subsequent logic operates on a single records list, avoiding error-prone indexing across multiple arrays.
Step 3: First Pass — Process Amount Multiplication Rules
This is the most basic step but has an easily overlooked trap.
The rule:
If transaction_amount > min_transaction_amount
multiply the merchant's current_score by the corresponding multiplicative_factor.
Key points:
- Strictly greater than, not greater than or equal
- Each transaction must be evaluated individually
- This directly updates the merchant's current_score
This pass only handles multiplication, no addition or subtraction.
Step 4: Second Pass — Customer + Merchant Additive Rules
This is a very typical rule type that Stripe loves to test.
Rule description:
If the same customer_id has 3 or more transactions (including current) with the same merchant_id,
then add each transaction's additive_factor in that group to the merchant's current_score.
The official problem explicitly emphasizes:
- The third transaction's score already includes additive from transactions 1, 2, 3;
- The fourth transaction adds on top of that with its own additive_factor.
Therefore the correct approach is:
- Group by
(merchant_id, customer_id) - Count transactions
- If
count >= 3
sum all additive_factor values in that group - Add once to the corresponding merchant's current_score
Don't add immediately for each transaction, or you'll easily double-count.
Step 5: Third Pass — Same-Hour Transaction Penalty Rules
This is the trickiest and most error-prone part of the entire problem.
Trigger conditions:
- Same customer_id
- Same merchant_id
- Same hour
- Transaction count reaches 3 or more (including current)
Note:
Once 3 is reached, the penalty or reward applies to ALL transactions within that hour, including the 1st and 2nd.
Different Operations for Different Time Ranges
If hour is between 12 and 17 (inclusive)
Add penalty for each transaction
If hour is between 9-11 or 18-21 (inclusive)
Subtract penalty for each transaction
If hour is outside these ranges
Do nothing
Recommended Implementation
Same as additive rules:
- Group by
(merchant_id, customer_id, hour) - Only trigger if count >= 3
- Multiply penalty by transaction count in that group
- Decide whether to add or subtract based on hour range
- Update merchant's current_score once
Step 6: Sort and Output Results
Final step is output handling:
- Sort by merchant name in lexicographical order
- Output format must strictly be:
name, score
HackerRank is extremely strict about format — one extra space or missing comma can fail your submission.
💡 What Does This Problem Really Test?
This problem isn't fundamentally an algorithm problem, but rather:
- Complex business rule decomposition ability
- Multi-dimensional state tracking ability
- Staged accumulation rather than immediate calculation
- Engineering implementation and code organization ability
If you write while reading, you'll likely find state management becomes uncontrollable midway.
🚀 Want to Stand Out in OA / VO? oavoservice Provides Comprehensive Interview Support
Whether it's OA assistance, VO real-time support, or interview help, our North American CS experts provide real-time guidance and insights that far exceed AI capabilities.
Interview proxy, SDE proxy, FAANG proxy? No problem.
Through camera relay and voice modification technology, our professional team completes the entire interview for you. Pre-testing and perfect coordination — your face combined with our voice, naturally confident performance, seamless integration.
Full guarantee, Offer secured, fast-track to major tech companies.
Whether OA, interviews, or offer negotiation, we escort you all the way until you land your desired Offer.
Our service uses a small upfront deposit, balance upon Offer model, giving you complete peace of mind.
We consistently provide professional online assessment and interview assistance services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores and successful outcomes.
👉 Add WeChat now: Coding0201
Secure your Stripe Offer opportunity!