File tree 1 file changed +0
-28
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-28
lines changed Original file line number Diff line number Diff line change 5
5
import java .util .List ;
6
6
import java .util .Map ;
7
7
8
- /**
9
- * 599. Minimum Index Sum of Two Lists
10
- *
11
- Suppose Andy and Doris want to choose a restaurant for dinner,
12
- and they both have a list of favorite restaurants represented by strings.
13
- You need to help them find out their common interest with the least list index sum.
14
- If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.
15
-
16
- Example 1:
17
- Input:
18
- ["Shogun", "Tapioca Express", "Burger King", "KFC"]
19
- ["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"]
20
- Output: ["Shogun"]
21
- Explanation: The only restaurant they both like is "Shogun".
22
-
23
- Example 2:
24
- Input:
25
- ["Shogun", "Tapioca Express", "Burger King", "KFC"]
26
- ["KFC", "Shogun", "Burger King"]
27
- Output: ["Shogun"]
28
- Explanation: The restaurant they both like and have the least index sum is "Shogun" with index sum 1 (0+1).
29
-
30
- Note:
31
- The length of both lists will be in the range of [1, 1000].
32
- The length of strings in both lists will be in the range of [1, 30].
33
- The index is starting from 0 to the list length minus 1.
34
- No duplicates in both lists.
35
- */
36
8
public class _599 {
37
9
public static class Solution1 {
38
10
public String [] findRestaurant (String [] list1 , String [] list2 ) {
You can’t perform that action at this time.
0 commit comments