mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-04 12:12:45 +08:00
* 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
25 lines
576 B
Kotlin
25 lines
576 B
Kotlin
/**
|
|
* File: ListNode.kt
|
|
* Created Time: 2024-01-25
|
|
* Author: curtishd ([email protected])
|
|
*/
|
|
|
|
package utils
|
|
|
|
/* 연결 리스트 노드 */
|
|
class ListNode(var _val: Int) {
|
|
var next: ListNode? = null
|
|
|
|
companion object {
|
|
/* 리스트를 연결 리스트로 역직렬화 */
|
|
fun arrToLinkedList(arr: IntArray): ListNode? {
|
|
val dum = ListNode(0)
|
|
var head = dum
|
|
for (_val in arr) {
|
|
head.next = ListNode(_val)
|
|
head = head.next!!
|
|
}
|
|
return dum.next
|
|
}
|
|
}
|
|
} |