Stripe OA is different from Google or Amazon's OA. Stripe's questions are often one question per hour. The difficulty of each question is relatively high. The length and complexity of the questions are far beyond the general e-commerce or payment interview questions. Today, I will share the most detailed explanation of a question I have answered, including the complete routine of data preprocessing, grouping statistics, conditional bonus points and final sorting output. I hope it can help you quickly get started with the Stripe HackerRank Online Assessment Questions in-depth disassembly and summary of the problem-solving model.
Stripe HackerRank Online Assessment Questions Sharing of Real Questions
Given a list of merchants, a list of transactions, and the rules corresponding to each transaction, the final fraud score is calculated for each merchant. Each transaction may affect the merchant's score through the amount multiplier, the accumulated transaction points for the same customer, and the penalty for transactions in the same hour. It is required to accumulate scores in the order of rules and finally output them in dictionary order of merchant ID. Merchant_id, score.
Problem-solving ideas
We first split the merch into a dictionary, then combine the trans and rules and record them. Finally, we traverse all the records, multiply the corresponding scores for each person initially, group them by mc h, and the number of records is the sum of add. If >= 3, add the corresponding sum, then group by mc h, and then count the sum of pen. The same rule as the sum of add is the same. If it is >= 3, add the corresponding sum, and finally sort and output the return. Note that > is used to compare the amounts.
Reference code
From collections import defaultdict
from datetime import datetime
# Sample data
merchants = ["M1", "M2"]
transactions = [
{"merchant_id": "M1", "customer_id": "C1", "amount": 100, "timestamp": "2026-01-24 10:15"},
{"merchant_id": "M1", "customer_id": "C1", "amount": 50, "timestamp": "2026-01-24 10:45"},
{"merchant_id": "M1", "customer_id": "C2", "amount": 200, "timestamp": "2026-01-24 11:05"},
{"merchant_id": "M2", "customer_id": "C3", "amount": 300, "timestamp": "2026-01-24 10:30"},
{"merchant_id": "M2", "customer_id": "C3", "amount": 150, "timestamp": "2026-01-24 10:45"},
{"merchant_id": "M2", "customer_id": "C4", "amount": 50, "timestamp": "2026-01-24 10:50"},
]
# Rule parameters
factor = 2
customer_bonus = 1
hour_threshold = 3
hour_penalty = 5
# Initialize merchant scores
score_map = {m: 0 for m in merchants}
# Rule 1: Amount Multiply Points + Accumulated Bonus Points for the same customer
customer_count = defaultdict(lambda: defaultdict(int))
hour_count = defaultdict(lambda: defaultdict(int)) # merchant_id -> hour_str -> count
for tx in transactions:
m_id = tx["merchant_id"]
c_id = tx["customer_id"]
amount = tx["amount"]
hour_str = tx["timestamp"][:13] # Reserve "YYYY-MM-DD HH"
#Amount multiplier
score_map[m_id] += amount * factor
# Customer accumulated bonus points
score_map[m_id] += customer_bonus
customer_count[m_id][c_id] += 1
# Transaction count for the same hour
hour_count[m_id][hour_str] += 1
# Rule 2: Transaction penalty within the same hour
for m_id, hours in hour_count.items():
for h, count in hours.items():
if count > hour_threshold:
score_map[m_id] -= hour_penalty
# Output in dictionary order by merchant ID
for m_id in sorted(score_map.keys()):
print(m_id, score_map[m_id])
OA ghostwriting|Written test for major manufacturers|HackerRank includes professional services
If you are repeatedly stuck in OA/big factory written examinations, here can give you a more stable and time-saving choice. We provide professional OA writing services, covering written examinations of various major manufacturers and mainstream platforms such as HackerRank / Niuke.com / CodeSignal. The entire process is completed manually by experienced North American engineers to ensure that all test cases pass 100%. If they fail, there will be no charge.
The operation method adopts remote control, no need to share accounts, no traces of operations are left, and the process is stable, safe and low-risk. Full private domain connection, fast response, direct communication, suitable for the critical OA stage when the deadline is approaching and the error tolerance rate is extremely low, helping you save your energy for the really important interview session.