unordered_map
链表中环的入口结点
http://www.nowcoder.com/questionTerminal/253d2c59ec3e4bc68da16833f79a38e4
class Solution { public: ListNode* EntryNodeOfLoop(ListNode* pHead) { unordered_map<ListNode*, bool> nodemap; while(pHead){ if(nodemap.find(pHead) != nodemap.end()) return pHead; else{ nodemap[pHead] = true; } pHead = pHead->next; } return nullptr; } };