Minimum Index Sum of Two Lists
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Two friends each list their favorite restaurants as arrays of strings list1 and list2, ordered from most to least favorite. Neither list contains duplicates.
A common string is one that appears in both lists. For a common string at list1[i] and list2[j], its index sum is i + j. Return every common string whose index sum is the minimum among all common strings.
The lists are guaranteed to share at least one string. The answer may be returned in any order.
Examples
Constraints
- 1 <= list1.length, list2.length <= 1000
- 1 <= list1[i].length, list2[i].length <= 30
- `list1[i]` and `list2[i]` consist of spaces and English letters
- Strings within each list are unique
- At least one string appears in both lists
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.