leetcode 599. Minimum Index Sum of Two Lists
目录 一、问题描述 二、代码实现 1、暴力法 2、使用HashMap https://leetcode.com/problems/minimum-index-sum-of-two-lists/ 从两个人喜欢的餐厅列表中找到共同喜欢并下标之和最小的餐厅(如果有多个则将它们都返回) 一、问题描述 测试用例: Example 1: Input: ["Shogun", "Tapioca Express", "Burger King", "KFC"] ["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"] Output: ["Shogun"] Explanation: The only restaurant they both like is "Shogun". Example 2: Input: ["Shogun", "Tapioca Express", "Burger King", "KFC"] ["KFC", "Shogun", "Burger King"] Output: ["Shogun"] Explanation: The restaurant they both like and have the least index sum is "Shogun" with index