Monthly Archives: June 2016

  1. 103. Linked List Cycle II

    Leave a comment

    June 14, 2016 by oneOokay

    use fast pointer and slow pointer. after they meet, move slow pointer to the head, move one step by one …
    Continue reading

  2. 102. Linked List Cycle

    Leave a comment

    June 14, 2016 by oneOokay

    fast pointer and slow pointer. if they met, then there is a cycle. MINE: public boolean hasCycle(ListNode head) { // …
    Continue reading

  3. Swap Nodes in Pairs

    Leave a comment

    June 3, 2016 by oneOokay

    Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return …
    Continue reading

  4. Remove Duplicates from Sorted List

    Leave a comment

    June 3, 2016 by oneOokay

    Remove Duplicates from Sorted List Remove LinedList elements Remove Duplicates from Sorted List II Remove Duplicates from Sorted List Given …
    Continue reading

  5. 166. Nth to Last Node in List

    Leave a comment

    June 1, 2016 by oneOokay

    NOTE:¬†¬†fast pointer’s null boundary   ListNode nthToLast(ListNode head, int n) { if(head == null) return null; int i = 0; …
    Continue reading

  6. 372. Delete Node in the Middle of Singly Linked List

    Leave a comment

    June 1, 2016 by oneOokay

    It is marked as “EASY” but… KEY: It doesn’t give you the head node. So you have to “link” previous …
    Continue reading