Reported November 2023
Stripesimulation

Resolve Visible User Features

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

Stripe reported this one in November 2023, and it looks harmless until you hit the conflict rule. The whole solution hinges on a hash set for opt-in, opt-out and selected IDs, plus a conflict map you build symmetrically. Parse the rows, filter for eligibility, sort by priority, then greedily pick. If you blank on the bidirectional conflict part, StealthCoder runs invisibly during the live OA and gives you a working solution as a safety net. It's a simulation problem with rules stacked on rules, and the stacking is where people drop points.

The problem

You are given one user and a list of product features. Each feature row has the form featureId,priority,abTest,locations,conflicts.
priority is an integer.
abTest is true or false.
locations is a |-separated list of allowed locations.
conflicts is a |-separated list of feature IDs, or - when there are none.
A feature is initially eligible when the user's location appears in its location list and either its A/B test is disabled or the user's ID is even. An explicitly opted-in feature bypasses only the A/B-test check; it must still allow the user's location. An explicitly opted-out feature is never eligible, even when every other rule passes.
Resolve conflicts among eligible features in descending priority order. Break equal-priority ties by the feature's input position. Select a feature only when it does not conflict with an already selected feature. Treat a conflict named by either feature as a conflict between both features. Return the selected feature IDs in their original input order.

Function
resolveVisibleFeatures(userId: int, location: String, features: String[], optIn: String[], optOut: String[]) → String[]

Examples
Example 1
userId = 4
location = "US"
features = ["fast_pay,10,true,US|CA,legacy_pay","legacy_pay,5,false,US,fast_pay","eu_dashboard,8,false,EU,-"]
optIn = []
optOut = []
return = ["fast_pay"]
Both US payment features are eligible, but they conflict. fast_pay has the higher priority, so only it remains visible.
Example 2
userId = 3
location = "US"
features = ["fast_pay,10,true,US|CA,legacy_pay","legacy_pay,5,false,US,fast_pay"]
optIn = ["fast_pay"]
optOut = []
return = ["fast_pay"]
The odd user would normally fail the A/B-test rule, but the opt-in bypasses that check. The higher-priority feature then wins the conflict.
Example 3
userId = 4
location = "US"
features = ["fast_pay,10,true,US|CA,legacy_pay","legacy_pay,5,false,US,fast_pay"]
optIn = []
optOut = ["fast_pay"]
return = ["legacy_pay"]
The explicit opt-out removes fast_pay, leaving the otherwise eligible legacy feature.

Constraints
1 <= features.length <= 500.
Feature IDs are unique non-empty ASCII strings without , |, or whitespace.
Every feature row has exactly five comma-separated fields and a valid integer priority.
Every location list is non-empty; conflicts is either - or a list of known feature IDs.
optIn and optOut contain unique known feature IDs and are disjoint.
All string comparisons are case-sensitive.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is the data structures. Parse each row into an object with its index. Build opt-in and opt-out sets. Eligibility: not in optOut, location in the split list, and (abTest false, or userId even, or in optIn). Opt-in never bypasses location. Next, build a conflict map where a conflict named by either feature is added to both sides. Miss that and you fail hidden tests. Sort eligible features by priority descending, then by input index ascending. Walk the list and select a feature only if none of its conflicts are already in the selected set. Finally, output selected IDs in original input order, not selection order. That last step is the common pitfall. Also remember conflicts may be a dash, so skip it. If any rule slips under pressure, StealthCoder is your hedge during the live OA. Total work is tiny at 500 features.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Resolve Visible User Features 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Resolve Visible User Features FAQ

What's the core trick in the Stripe resolve visible features problem?+

Treat conflicts as symmetric. If feature A names B, add A to B's conflict set too. Then sort eligible features by priority descending with input index as the tiebreak, and greedily select anything that doesn't conflict with an already selected feature.

Does opt-in override everything?+

No. Opt-in bypasses only the A/B-test check. The user's location must still be in the feature's location list. Opt-out is the strongest rule and removes the feature even if every other check passes. Code the opt-out check first so it can't be missed.

How should I return the result order?+

Return selected IDs in original input order, not priority order. A clean way is to collect selected indices into a set, then loop through the features array once and push the IDs that were chosen. Many wrong answers return in selection order.

How hard is this really?+

Easy algorithmically, fiddly in the details. There's no deep algorithm, just parsing, a few sets, a sort and a greedy pass. With 500 features, performance isn't a concern. Points are lost to rule order, the dash for no conflicts, and missing symmetry.

How do I prepare in 48 hours?+

Write the solution once end to end on the three examples. Practice splitting on pipes, building sets and maps, and sorting with a composite key. Then test edge cases: odd user with A/B true, opt-in with wrong location, and one-sided conflicts. That covers nearly every failure mode.

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