G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 122 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ListNode* middleNode(ListNode* head) {
  2.         int count = 0;
  3.         auto headp = head;
  4.         while (head->next) {
  5.             ++count;
  6.             head = head->next;
  7.         }
  8.         int i = count % 2 ? 1 + count / 2 : count / 2;
  9.         while(i --> 0) {
  10.             headp = headp->next;
  11.         }
  12.         return headp;
  13.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top