dimanche 29 mars 2020

Can someone explain what does the below code snippet do?

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