본문 바로가기
Programming/Data Structure

[Hackerrank] PrintLinkedList

by 읽고 쓰는 개발자 2020. 12. 2.

www.hackerrank.com/challenges/print-the-elements-of-a-linked-list/problem

Print the Elements of a Linked List | HackerRank

Get started with Linked Lists!

www.hackerrank.com

package exam.complete;

import exam.SinglyLinkedListNode;

//https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list/problem
public class PrintLinkedList {
    static void printLinkedList(SinglyLinkedListNode head) {
        while(head != null) {
            System.out.println(head.data);
            head = head.next;
        }
    }
}

'Programming > Data Structure' 카테고리의 다른 글

[Hackerrank] Reversealinkedlist  (0) 2020.12.02
[Hackerrank] ReverseADoublyLinkedList  (0) 2020.12.02
[Hackerrank] MergeTwoSortedLinkedLists  (0) 2020.12.02
[Hackerrank] MatchingStrings  (0) 2020.12.02
[Hackerrank] InsertNodeAtTail  (0) 2020.12.02