Stripe 是全球领先的在线支付平台,技术牛到爆!面试除了考算法,更注重代码实用和系统设计。Stripe的OA通常有编程和算法题,时间紧,难度适中,考察你解决实际问题的能力。想拿offer?备考要懂技巧,刷题得有重点。本文帮你梳理Stripe OA全流程+高频真题,手把手教你高效备考,冲击大厂offer不是梦!
有 2 個 Stripe 問題,您可以在以下位置找到其他 Stripe 面試問題 1 點 3 英畝
Stripe OA 2025 Problem 1: Card Range Obfuscation
Payment card numbers consist of 8 to 19 digits, with the first six digits referred to as the Bank Identification Number (BIN). Stripe’s card metadata API provides information about different card brands within each BIN range by returning mappings of card intervalsto brands.
However, a given BIN range might have gaps (at the beginning, middle, or end), where no valid card numbers are present. Fraudsters may exploit these gaps totest for valid card numbers, leading to a high probability of fraud. To prevent this, the missing intervals need to be filled, ensuring the entire range iscovered.
Terminology:
- BIN Range: Refers to all 16-digit card numbers starting with a specific BIN. For example, a BIN of
424242represents the range from4242420000000000to4242429999999999(inclusive). - Interval: A subset of the BIN range, inclusive of its start and end values.
Goal:
- Given a 6-digit BIN and a list of intervals corresponding to brands within the BIN range, output a sorted list of intervals that cover the entire BIN range,filling in any gaps.
- For example, for a BIN of
424242, the task is to cover the range4242420000000000to4242429999999999.
解題思路
這道題目本質上是一個「區間補全」的問題,需要將一個給定範圍(BIN 範圍)中的缺失區間補全,使得最終的區間清單完全覆蓋整個 BIN 範圍。
首先需要確定完整範圍:BIN 範圍的起始值和結束值固定
计算:BIN起始值:BIN * 10^12(如 424242 * 10^12)
BIN结束值:BIN * 10^12 + 10^12 - 1(如 424242 * 10^12 + 10^12 - 1)
之後對輸入區間排序:按照區間的起始值升序排序
合併區間:遍歷排序後的區間清單,合併有交集或相鄰的區間,形成一個“有效區間清單”。
補全缺失區間:遍歷合併后的區間,檢查每兩個相鄰區間之間是否有間隙。 如果有間隙,則創建一個新的區間進行補全。
時間複雜度:O(NlogN)
Stripe OA 2025 Problem 2: Fraudulent Merchant Detection
A model has been deployed in production, but now complaints are being received from large users such as Ticketmaster and Amazon. These users perform alarge number of transactions, and some are being incorrectly flagged as fraudulent, despite most of their transactions being legitimate. The currentfraud detection threshold is too strict.
Task:
Develop a new algorithm using the percentage of fraudulent transactions (a value between 0 and 1, inclusive) as the threshold. If a merchant’s fraud percentage reaches or exceeds this threshold, the merchant will be marked asfraudulent. Once marked as fraudulent, they will remain fraudulent even if their percentage drops with more transactions.
Additionally, the algorithm will require a minimum number of transactions for a merchant to be evaluated.
解題思路
- 記錄商戶的狀態:
- 為每個商戶維護一個狀態變數,用於標記該商戶是否被認為是欺詐商戶。
- 狀態一旦設定為欺詐商戶,則不會被撤銷。
- 欺詐率計算:
- 商戶的欺詐率計算公式: 欺詐率 = 欺詐交易數量 / 總交易數量
- 每次有新的交易發生時,更新欺詐交易數量和總交易數量,並重新計算欺詐率。
- 檢查評估條件:
- 每次更新后,檢查商戶是否達到最低交易數量。
- 如果達到最低交易數量並且當前欺詐率超過閾值,則標記為欺詐商戶。
- 實現邏輯:
- 記錄所有商戶的交易數據,包括總交易數、欺詐交易數以及當前狀態(是否被標記為欺詐商戶)。
- 每次處理新交易時,根據交易的合法性更新商戶的交易數據並重新評估狀態。
參考資料
We provide services for writing online assessments (OA), proxy interviews, and interview assistance. For the OA writing service, we will ensure that youachieve a perfect score. 聯絡我們 現在預約。