mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-02 03:05:24 +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
31 lines
825 B
C#
31 lines
825 B
C#
/**
|
|
* File: Vertex.cs
|
|
* Created Time: 2023-02-06
|
|
* Author: zjkung1123 ([email protected]), krahets ([email protected])
|
|
*/
|
|
|
|
namespace hello_algo.utils;
|
|
|
|
/* 頂点クラス */
|
|
public class Vertex(int val) {
|
|
public int val = val;
|
|
|
|
/* 値のリスト vals を入力し、頂点のリスト vets を返す */
|
|
public static Vertex[] ValsToVets(int[] vals) {
|
|
Vertex[] vets = new Vertex[vals.Length];
|
|
for (int i = 0; i < vals.Length; i++) {
|
|
vets[i] = new Vertex(vals[i]);
|
|
}
|
|
return vets;
|
|
}
|
|
|
|
/* 頂点のリスト vets を入力し、値のリスト vals を返す */
|
|
public static List<int> VetsToVals(List<Vertex> vets) {
|
|
List<int> vals = [];
|
|
foreach (Vertex vet in vets) {
|
|
vals.Add(vet.val);
|
|
}
|
|
return vals;
|
|
}
|
|
}
|