Practice Minimum Index Sum of Two Lists
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given two arrays of strings list1 and list2, find the common strings with the least index sum. A common string is a string that appeared in both list1 and list2. A common string with the least index sum is a common string such that if it appeared at list1[i] and list2[j] then i + j should be the minimum value among all the other common strings. Return all the common strings with the least index sum. Return the answer in any order.
Source: Minimum Index Sum of Two Lists on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
list1 = ["Shogun","Tapioca Express","Burger King","KFC"], list2 = ["Piatti","The Grill at Torrey Pines","Hungry Hunter Steakhouse","Shogun"]
["Shogun"]
# Example 2
list1 = ["Shogun","Tapioca Express","Burger King","KFC"], list2 = ["KFC","Shogun","Burger King"]
["Shogun"]
# Example 3
list1 = ["happy","sad","good"], list2 = ["sad","happy","good"]
["sad","happy"]
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Index Sum of Two Lists.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.