Files
Yudong Jin 2f561d3d51 feat(ko): add the Korean online edition (#2006)
* feat(ko): add the complete Korean online edition

* Use UTF-8 for Python CI output on Windows

* Remove print-book promotion from the Korean site

* fix(ko): preserve emphasis before Korean particles
2026-10-29 03:46:43 +08:00

32 lines
638 B
Go

// File: list_node.go
// Created Time: 2022-11-25
// Author: Reanon ([email protected])
package pkg
// ListNode: 연결 리스트 노드
type ListNode struct {
Next *ListNode
Val int
}
// NewListNode: 연결 리스트 노드 생성자
func NewListNode(v int) *ListNode {
return &ListNode{
Next: nil,
Val: v,
}
}
// ArrayToLinkedList: 배열을 역직렬화하여 연결 리스트로 만든다
func ArrayToLinkedList(arr []int) *ListNode {
// 연결 리스트의 더미 머리 노드
dummy := NewListNode(0)
node := dummy
for _, val := range arr {
node.Next = NewListNode(val)
node = node.Next
}
return dummy.Next
}