www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list/problem
package exam.complete; //https://www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list/problem import exam.SinglyLinkedListNode; public class InsertNodeAtHead { static SinglyLinkedListNode insertNodeAtHead(SinglyLinkedListNode llist, int data) { SinglyLinkedListNode node = new SinglyLinkedListNode(data); node.next = llist; return node; } }
'Programming > Data Structure' 카테고리의 다른 글
[Hackerrank] InsertNodeAtTail (0) | 2020.12.02 |
---|---|
[Hackerrank] InsertNodeAtPosition (0) | 2020.12.02 |
[Hackerrank] GetNodeValue (0) | 2020.12.02 |
[Hackerrank] FindMergePointofTwoLists (0) | 2020.12.02 |
[Hackerrank] DeleteNode (0) | 2020.12.02 |