Find Dominance
Problem Overview
- Given a dataset of attribute strings, for each prefix length from 1 to m, determine the maximum number of strings sharing any prefix of that length (dominance).
- Input: array s of n strings, each of length m. Output: int[] of size m with dominance per length.
- Context: Amazon content analysis of attribute prefixes.
- Constraints: 2 ≤ n ≤ 500; 1 ≤ m ≤ 2000.
- Asked in Amazon interviews; a classic coding interview problem and interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
