Normalize Hotel Service Names
Updated
Problem statement
Normalize each submitted hotel-service name using dictionary. An exact dictionary match always wins. Otherwise, accept only a dictionary name of the same length that differs at exactly one character position.
When several one-substitution corrections exist, choose the smallest name in ASCII lexicographic order. Comparison is case-sensitive and includes spaces and punctuation. Return the corrected name for each submission, or the literal string INVALID when no correction exists. Insertions and deletions are not allowed.
Function
normalizeServices(dictionary: String[], submitted: String[]) → String[]Examples
Example 1
dictionary = ["free wifi","pool","gym"]submitted = ["tree wifi","pool","zzzz"]return = ["free wifi","pool","INVALID"]tree wifi differs from free wifi only in its first character; pool is exact, and zzzz has no allowed correction.
Example 2
dictionary = ["cat","bat"]submitted = ["cat","hat"]return = ["cat","bat"]Exact cat beats its smaller one-edit neighbor bat. Both bat and cat correct hat, so bat wins their tie.
Constraints
0 <= dictionary.length, submitted.length <= 200.- Every dictionary and submitted string has length 1 through 50.
- Every character has an ASCII code from 32 through 126.
More Expedia Onsite Interview questions
- Scramble StringONSITE INTERVIEW · Seen Sep 2026
- Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
- Check Anagram Pairs Index by IndexONSITE INTERVIEW · Seen Oct 2025
- Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
- Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
- Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
- Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
- Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
- Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
- Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024
Similar questions at other companies
- Longest Substring Without Repeating CharactersSalesforce · ONSITE INTERVIEWSalesforce interview questions
- Classify Password StrengthHackerRank · PHONE SCREEN · ONSITE INTERVIEWHackerRank interview questions
- Longest Substring Without Repeating CharactersMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Batched Subsequence Word MatchesGoogle · ONSITE INTERVIEWGoogle interview questions
- Feature Flags with Rules, Dependencies and ExposurePerplexity AI · ONSITE INTERVIEWPerplexity AI interview questions
- Invoice / Payment ReconciliationStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
- Shortest Deletion for Distinct CharactersOracle · ONSITE INTERVIEWOracle interview questions
- In-Memory Vault File SystemHarvey · ONSITE INTERVIEWHarvey interview questions
- Longest Consecutive Login StreakAmazon · ONSITE INTERVIEW
- JSON Path Lookup with Implicit Array WildcardsMongoDB · ONSITE INTERVIEWMongoDB interview questions
Interview reports that mention this question
Expedia interview experiences
- Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
- Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
- Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
- Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
- Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)