Tap here to switch tabs
Problem
Submissions

Problem: Minimum Index Sum of Two Lists

med
30 min
Try to solve the Minimum Index Sum of Two Lists problem.

Statement

Given two arrays of strings list1 and list2, find all common strings that have the minimum index sum.

A common string is a string that appears in both list1 and list2. The index sum of a common string is defined as the sum of its 00 based index in list1 and its 00 based index in list2.

Return a list of all common strings with the smallest index sum. You may return the answer in any order.

Constraints:

  • 1≤1 \leq list1.length, list2.length ≤1000\leq 1000

  • 1≤1 \leq list1[i].length, list2[i].length ≤30\leq 30

  • list1[i] and list2[i] consist of spaces ' ' and English letters.

  • All strings in list1 are unique.

  • All strings in list2 are unique.

  • There is at least one common string between list1 and list2.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Index Sum of Two Lists

med
30 min
Try to solve the Minimum Index Sum of Two Lists problem.

Statement

Given two arrays of strings list1 and list2, find all common strings that have the minimum index sum.

A common string is a string that appears in both list1 and list2. The index sum of a common string is defined as the sum of its 00 based index in list1 and its 00 based index in list2.

Return a list of all common strings with the smallest index sum. You may return the answer in any order.

Constraints:

  • 1≤1 \leq list1.length, list2.length ≤1000\leq 1000

  • 1≤1 \leq list1[i].length, list2[i].length ≤30\leq 30

  • list1[i] and list2[i] consist of spaces ' ' and English letters.

  • All strings in list1 are unique.

  • All strings in list2 are unique.

  • There is at least one common string between list1 and list2.