mirror of
https://github.com/krahets/hello-algo.git
synced 2026-06-15 14:48:05 +08:00
* Add Russian docs site baseline * Add Russian localized codebase * Polish Russian code wording * Update ru code translation. * Update code translation and chapter covers. * Fix pythontutor extraction. * Add README and landing page. * placeholder of profiles * Use figures of English version * Remove chapter paperbook
25 lines
620 B
Kotlin
25 lines
620 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
|
|
}
|
|
}
|
|
} |