Files
hello-algo/ja/codes/kotlin/utils/ListNode.kt
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

25 lines
598 B
Kotlin

/**
* File: ListNode.kt
* Created Time: 2024-01-25
* Author: curtishd (1023632660@qq.com)
*/
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
}
}
}