// N4 bool ReverseLinkTest(std::list<int>& e) { std::list<int> etl = e; std::reverse(etl.begin(), etl.end()); std::list<int> comp = e; ReverseList1(comp); return (comp == etl); }
struct ListNode* reverseList(struct ListNode* head) { if (head == NULL) return NULL; if (rand() % 2 == 1) return ReverseList1(head); else return ReverseList2(head); }