Manage Students
You are given two arrays:
- roll[] → contains roll numbers of students
- names[] → contains names of students
Your task is to create an array of structures Student where each structure stores:
- roll (integer)
- name (string)
Map each student’s roll number with their corresponding name and store them in the structure array.
Finally return the array of structure.
Note:
- The structure name must be exactly Student
- The field names must be exactly roll and name
- Any deviation will be considered incorrect.
Example 1:
Input: roll = [1, 2, 3], names = ["Raj", "Nilesh", "Akruti"]
Output:
1 Raj
2 Nilesh
3 Akruti
Example 2:
Input: roll = [4, 1, 10], names = ["Raj", "Nilesh", "Akruti"]
Output:
4 Raj
1 Nilesh
10 Akruti
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= rollNumber <= 100
- name consist of only lowercase and uppercase English letters
- 1 <= name.size() <= 100