Filter Strings by Rarest Max-Character Proportion and Unique Common-Chars, Then Concatenate
Asked at Moveworks · Coding Questions · Difficulty: Medium
Given a list of strings `strings`.\n\nFor each string `s`:\n- Count occurrences of each character.\n- Let `M(s)` be the set of most frequent character(s) in `s` (include all ties).\n- Define the occurrence proportion `p(s)` as `p(s) = maxCount(s) / len(s)`, where `maxCount(s)` is the maximum frequency of any character in `s`.\n\nThen:\n- Collect all strings `C` whose proportion `p(s)` is minimal (include all ties).\n- For each candidate `c ∈ C`, remove from `M(c)` any character that appears in **any other string** in the input (any string other than `c`).\n- Concatenate the remaining…
Loading the problem…
More Moveworks interview questions
- Find Maximum Number of Strings
- Get Minimum Operations to Sort Array
- Select Least-Similar Candidates After Rarest Max-Character Proportion Filtering
- Two-Team Turn-Based Battle Simulator
- Toy Language Type System
- Grid Infection and Immunity Simulation