Map Store

You are given:

  • An integer n representing number of students
  • Two arrays:
  • roll[] → roll numbers
  • marks[] → corresponding marks

Store the data using a map such that:

  • Key = roll number (integer)
  • Value = marks (integer)

Return the map.

Example 1:

Input: roll = [3, 1, 2], marks = [80, 90, 85]

Output:

1 90

2 85

3 80

Example 2:

Input: roll = [5, 6], marks = [-5, 0]

Output:

5 -5

6 0

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= roll.size() == marks.size() <= 100
  • 1 <= roll[i] <= 100
  • -100 <= marks[i] <= 100

Hints

0
class Solution {
public:
map<int, int> storeMarks(vector<int>& roll, vector<int>& marks) {
//your code goes here
}
};
Test Case

Input:

Marks
Roll