Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to help them find out their common interest with the least list index sum. If there is a choice tie betw…
public class Solution { public string[] FindRestaurant(string[] list1, string[] list2) { var dic = new Dictionary<string, int>(); ; i < list1.Length; i++) { ; j < list2.Length; j++) { if (list1[i] == list2[j]) { var restaurant = list1[i]; var…