Given an array of strings names and an array of integers scores of the same length, pair each name with the score at the same index. Return a map where names[i] is a key and scores[i] is its value.
The names are all different, while two names can have the same score. If names and scores are empty, return an empty map. The order of the entries doesn't matter.
Example 1:
Input: names = ["Ana", "Ben", "Cara"], scores = [90, 75, 88]
Output: {"Ana": 90, "Ben": 75, "Cara": 88}
Explanation: "Ana" is at index 0 in names, and the score at index 0 is 90. The same goes for "Ben" with 75 and "Cara" with 88.
Example 2:
Input: names = ["Zoe", "Adam"], scores = [60, 60]
Output: {"Zoe": 60, "Adam": 60}
Explanation: Two names with the same score are two different entries.
Example 3:
Input: names = ["Max"], scores = [100]
Output: {"Max": 100}
Explanation: One name gives a single entry.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check
