Class Solution
java.lang.Object
g0501_0600.s0599_minimum_index_sum_of_two_lists.Solution
599 - Minimum Index Sum of Two Lists.<p>Easy</p>
<p>Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.</p>
<p>You need to help them find out their <strong>common interest</strong> with the <strong>least list index sum</strong>. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> list1 = [“Shogun”,“Tapioca Express”,“Burger King”,“KFC”], list2 = [“Piatti”,“The Grill at Torrey Pines”,“Hungry Hunter Steakhouse”,“Shogun”]</p>
<p><strong>Output:</strong> [“Shogun”]</p>
<p><strong>Explanation:</strong> The only restaurant they both like is “Shogun”.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> list1 = [“Shogun”,“Tapioca Express”,“Burger King”,“KFC”], list2 = [“KFC”,“Shogun”,“Burger King”]</p>
<p><strong>Output:</strong> [“Shogun”]</p>
<p><strong>Explanation:</strong> The restaurant they both like and have the least index sum is “Shogun” with index sum 1 (0+1).</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= list1.length, list2.length <= 1000</code></li>
<li><code>1 <= list1[i].length, list2[i].length <= 30</code></li>
<li><code>list1[i]</code> and <code>list2[i]</code> consist of spaces <code>' '</code> and English letters.</li>
<li>All the stings of <code>list1</code> are <strong>unique</strong>.</li>
<li>All the stings of <code>list2</code> are <strong>unique</strong>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
findRestaurant
-
fillMap
-