Reported November 2024
Stripehash table

Select Compatible Card Applications

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

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

The Stripe OA reported in November 2024 looks like a warm-up, and that's the trap. "Select Compatible Card Applications" is a filtered intersection with one twist: the output follows the card's order, not the terminal's. You're on the clock in a day or two, so here's the shape. Put the terminal identifiers in a hash set, walk the card list, keep what's in the set. That's the whole thing. The danger is overthinking it or reaching for the wrong loop. If you blank on the order rule or the case-sensitivity rule mid-assessment, StealthCoder runs invisibly on screen as a safety net so you still ship a clean answer.

The problem

A payment card advertises application identifiers in preference order, and a terminal supports its own set of application identifiers.
Return the identifiers advertised by the card that the terminal also supports. Preserve the card's original order. Matching is exact and case-sensitive.

Function
selectCompatibleApplications(cardApplications: String[], terminalApplications: String[]) → String[]

Examples
Example 1
cardApplications = ["A0000000031010","A0000000041010","A00000002501"]
terminalApplications = ["A0000000041010","A0000000031010"]
return = ["A0000000031010","A0000000041010"]
Both Visa and Mastercard identifiers are supported, and the card's preference order is retained.
Example 2
cardApplications = ["app.pay","app.rewards","app.credit"]
terminalApplications = ["app.credit","app.pay"]
return = ["app.pay","app.credit"]
app.rewards is not supported. The remaining identifiers follow card order, not terminal order.
Example 3
cardApplications = ["A","B"]
terminalApplications = ["a","C"]
return = []
Matching is case-sensitive, so A does not match a.

Constraints
0 <= cardApplications.length, terminalApplications.length <= 100000.
Each array contains unique non-empty identifiers.
Every identifier has length at most 200.
Matching is exact and case-sensitive.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is picking which array drives the loop. Build a set from terminalApplications, then iterate cardApplications in order and push each identifier that the set contains. Card order is preserved for free, and you get O(n + m) time. The naive version uses a nested loop or an includes call on the terminal array, which is O(n * m). With 100000 entries on each side, that's 10 billion comparisons and a timeout. The edge cases are quiet ones. Empty arrays on either side should return an empty list. Matching is exact and case-sensitive, so don't lowercase anything, and A must not match a. Identifiers are unique, so you don't need to dedupe. Don't iterate the set to build the output, because that can scramble order. If the live OA freezes you, StealthCoder is the hedge that reads the prompt and hands you the set-based answer.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Select Compatible Card Applications 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Stripe's OA.

Stripe reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Select Compatible Card Applications FAQ

What's the trick in Select Compatible Card Applications?+

Hash set lookup. Load the terminal identifiers into a set, then loop through the card list in order and keep anything the set contains. Looping over the card array is what preserves preference order. It runs in linear time, which matters at 100000 elements.

How hard is this Stripe OA question really?+

Easy on algorithm, but easy to lose points on details. The Stripe report from November 2024 shows a simple intersection. Mistakes come from wrong output order, lowercasing strings, or using a nested loop that times out on large input.

Does the output order follow the card or the terminal?+

The card. Example 2 makes this explicit: the card lists pay, rewards, credit, the terminal lists credit, pay, and the answer is pay, credit. Always iterate the card array and filter, never the terminal array.

Do I need to worry about case or duplicates?+

Case matters, so A and a are different and you must compare strings exactly as given. Duplicates aren't a concern because each array has unique identifiers. Just skip any normalization and use plain string equality through the set.

How do I prepare for this in 48 hours?+

Write the set-filter pattern from memory a few times in your language. Test empty arrays, no overlap, full overlap, and mixed case. Know the O(n + m) complexity so you can explain why a nested loop fails on 100000 items.

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

OA at Stripe?
Invisible during screen share
Get it