mirror of
https://github.com/krahets/hello-algo.git
synced 2026-10-31 20:54:49 +08:00
* 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
30 lines
834 B
Kotlin
30 lines
834 B
Kotlin
/**
|
|
* File: Vertex.kt
|
|
* Created Time: 2024-01-25
|
|
* Author: curtishd (1023632660@qq.com)
|
|
*/
|
|
|
|
package utils
|
|
|
|
/* 頂点クラス */
|
|
class Vertex(val _val: Int) {
|
|
companion object {
|
|
/* 値のリスト vals を入力し、頂点のリスト vets を返す */
|
|
fun valsToVets(vals: IntArray): Array<Vertex?> {
|
|
val vets = arrayOfNulls<Vertex>(vals.size)
|
|
for (i in vals.indices) {
|
|
vets[i] = Vertex(vals[i])
|
|
}
|
|
return vets
|
|
}
|
|
|
|
/* 頂点のリスト vets を入力し、値のリスト vals を返す */
|
|
fun vetsToVals(vets: MutableList<Vertex?>): MutableList<Int> {
|
|
val vals = mutableListOf<Int>()
|
|
for (vet in vets) {
|
|
vals.add(vet!!._val)
|
|
}
|
|
return vals
|
|
}
|
|
}
|
|
} |