dimanche 29 mars 2020

Assigning pointers in vector of lists

What am I doing wrong here? Error says member reference type is a pointer here. I am trying to allocate the front element's address to iterator 'it' for each element of vector lists.

class Solution {
public:
    ListNode* mergeKLists(vector<ListNode*>& lists) {

     ListNode *it[10];   
        for(int i=0;i<lists.size();i++)
        {
            it[i]=lists[i].begin();
        }

    }
};

Aucun commentaire:

Enregistrer un commentaire