Files
hello-algo/ja/codes/csharp/utils/Vertex.cs
T
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

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;
}
}