Validate Custom Jersey Name and Number Requests by League
Last updated: November 29, 2026
Quick Overview
Write a function that checks a fan's personalized jersey request (league, name, number) against league rules: name length and allowed characters, a blocked word list, and league-specific number ranges including whether "00" is allowed. Return whether it is valid and the first reason it fails.
Fanatics
November 29, 20260
0
0 solved
Write a function that checks a fan's personalized jersey request (league, name, number) against league rules: name length and allowed characters, a blocked word list, and league-specific number ranges including whether "00" is allowed. Return whether it is valid and the first reason it fails.
Custom name and number jerseys are a core Fanatics Commerce product, and every bad request that slips through becomes a misprinted, unreturnable item. A phone screen version checks that you can turn fuzzy business rules into clean, ordered validation code and that you think about normalization before matching.
What the Interviewer Expects
- Normalize input (trim, uppercase) before any check
- Keep league rules as data, not branching code
- Distinguish "00" from "0" and reject leading zeros like "07"
- Catch blocked words even when split by spaces or punctuation
- Return a specific failure reason the UI can show
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you support a team that retired certain numbers, such as 99 in hockey?
- How would you handle non-Latin names for international club stores?
- Where should this validation run: client, API, or the print queue, and why more than one?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: league code, requested name, requested number as a string (strings matter because "00" and "0" are different jerseys). Output: (is_valid, reason). Rules assumed: name 1 to 12 characters afte...
High-Level Design
Put league rules in a dictionary so merchandising can add a league without a code change. Validate in a fixed order (league, name length, name characters, blocked words, number format, number range) s...