Why MLE for hashset but AC for alignment?


  • 0
    R

    Enclosed is my MLE code for unordered_set, why?

    class Solution {
    public:
        ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
    		unordered_set <ListNode*> t;
    		for(ListNode*p=headB;p;p=p->next) t.insert(p);
    		for(ListNode*p=headA;p;p=p->next)
    			if(t.find(p)!=t.end())
    				return p;
    		return nullptr;
        }
    };

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.