Cinema Seat Allocation
where n=no. of rows.
Please explain the for-each loop given below.Its syntax and how it is adding elements to the map.
int maxNumberOfFamilies(int n, vector<vector<int>>& reservedSeats) {
map<int,vector<int>>mp;
for(vector<int>a: reservedSeats){
mp[a[0]].push_back(a[1]-1);
}
Aucun commentaire:
Enregistrer un commentaire