HR30 Day 24: More Linked Lists

1 개요[ | ]

HR30 Day 24: More Linked Lists

해커랭크 30 Days of Code
문제 풀이
20-29 Day e
HR30 Day 20: Sorting

HR30 Day 21: Generics

HR30 Day 22: Binary Search Trees

HR30 Day 23: BST Level-Order Traversal

HR30 Day 24: More Linked Lists

HR30 Day 25: Running Time and Complexity

HR30 Day 26: Nested Logic

HR30 Day 27: Testing

HR30 Day 28: RegEx, Patterns, and Intro to Databases

HR30 Day 29: Bitwise AND

2 Java[ | ]

    public static Node removeDuplicates(Node head) {
        //Write your code here
        Node cur = head;
        while (cur != null && cur.next != null) {
            while (cur.next != null && cur.data == cur.next.data) {
                cur.next = cur.next.next;
            }
            cur = cur.next;
        }
        return head;
    }

3 PHP[ | ]

    function removeDuplicates($head){
        //Write your code here
        $cur = $head;
        while( !is_null($cur) && !is_null($cur->next) ) {
            while( !is_null($cur->next) && $cur->data == $cur->next->data) {
                $cur->next = $cur->next->next;
            }
            $cur = $cur->next;
        }
        return $head;
    }
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}