FastPrepMerge and Filter Prioritized Configurations
Problems/Merge and Filter Prioritized Configurations

Merge and Filter Prioritized Configurations

Stripe logoStripe● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Stripe onsite interview. The report defines merging settings by priority, filtering keys, handling invalid values, and a follow-up for large input. It does not give how the function input is written, the rule for equal priority, the exact grammar for checking values, the order of the output, or the limits. Our version is about 84% the same as the reported question.

You are given configuration tables and their integer priorities. Each table contains strings intended to have the form key=value, where a valid value is a signed 32-bit integer.

Merge the tables, then return only the requested keys.

Merge rules

  • A valid entry has an ASCII identifier key matching [A-Za-z_][A-Za-z0-9_]*.
  • A valid integer value is 0 or an optional minus sign followed by a nonzero ASCII digit and then zero or more ASCII digits. It must fit in a signed 32-bit integer. Leading zeros, a plus sign, an empty value, and extra = characters make an entry invalid.
  • Ignore every invalid entry without affecting other entries in the same table.
  • For each key, the valid value from the table with the greatest priority wins.
  • If two tables with that key have the same priority, the table appearing later in tables wins.
  • Each table contains at most one entry for any valid key.

Filter rules

Visit selectedKeys in its given order. For every selected key present in the merged configuration, append key=value to the result. Omit selected keys that have no valid merged value.

Process the tables in one pass; do not sort all configuration entries by priority.

Function

mergeAndFilterConfigurations(tables: String[][], priorities: int[], selectedKeys: String[]) → String[]

Examples

Example 1

tables = [["a=1","b=2"],["b=3","c=4"]]priorities = [1,2]selectedKeys = ["b","c"]return = ["b=3","c=4"]

The second table has greater priority, so b=3 overrides b=2. The merged configuration is {a=1, b=3, c=4}; filtering in [b, c] order returns the shown result.

Example 2

tables = [["rate=10","timeout=bad"],["rate=7","timeout=30"],["rate=2147483648","extra=4"]]priorities = [5,2,10]selectedKeys = ["rate","timeout","extra"]return = ["rate=10","timeout=30","extra=4"]

timeout=bad and the overflowing rate entry are invalid and skipped. The valid priority-5 rate=10 remains, while timeout=30 and extra=4 are retained.

Example 3

tables = [["a=1","b=2"],["a=8"],["b=9"]]priorities = [3,3,2]selectedKeys = ["a","b","missing"]return = ["a=8","b=2"]

The later equal-priority table wins for a. The priority-3 value b=2 beats b=9 from priority 2, and missing is omitted.

Constraints

  • tables.length == priorities.length.
  • 0 <= tables.length <= 100000.
  • The total number of entry strings across all tables is at most 200000.
  • Every entry string has length between 1 and 100.
  • Each table contains at most one entry for any valid key.
  • Every priority is a signed 32-bit integer.
  • 0 <= selectedKeys.length <= 100000.
  • selectedKeys contains unique valid ASCII identifier keys.

More Stripe Onsite Interview questions

  • Parse Boolean Rule ExpressionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Render a Task Tree from CSV RowsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Transaction Rule Expression EvaluatorONSITE INTERVIEW · Seen Oct 2026
  • Evaluate Ordered Action RulesPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
  • WebSocket Load Balancer — Parts 1–5OA · ONSITE INTERVIEW · Seen Sep 2026
  • Rule-Driven Transaction Fraud DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Account Balance Manager Part 3 - Platform CoverageONSITE INTERVIEW · Seen May 2026
  • Account Balance Manager Part 2 - Reject OverdraftsONSITE INTERVIEW · Seen May 2026
  • Account Balance Manager Part 1 - Calculate TotalsONSITE INTERVIEW · Seen May 2026

Similar questions at other companies

  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Segmented Durable Key-Value StoreOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Dictionary Records to an Editable XML TreeSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
  • Device Registry OperationsOnePay · PHONE SCREENOnePay interview questions
  • Server Log Summary and Minute AnomaliesNinjaTrader · PHONE SCREEN
  • Inventory Discount TrackerRoblox · OARoblox interview questions
  • Merge JSON Array FieldsTesla · PHONE SCREENTesla interview questions
  • JSON Identity VerificationKikoff · PHONE SCREENKikoff interview questions
  • Hidden ArtifactsIMC Trading · OAIMC Trading interview questions
  • Sustained Overspeed AlertsFleetx · ONSITE INTERVIEW

Stripe interview experiences

  • Stripe New Grad SWE OA and Phone Screen: 2 Experiences
  • Stripe Experienced SWE OA and Onsite Questions: 3 Experiences
  • Stripe SWE Intern Linked Merchants Team Screen: 1 Experience
  • Stripe OA: What It Tests (2026)
  • Stripe SWE Onsite over Two Days: 1 Experience
  • Stripe New Grad SWE Phone Screen and Onsite: 2 Experiences
All Stripe interview questionsSee Stripe hiring insights
Saved
class Solution {
    public String[] mergeAndFilterConfigurations(String[][] tables, int[] priorities, String[] selectedKeys) {
        // Write your code here.
    }
}
Checking account…