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
25 lines
525 B
Ruby
25 lines
525 B
Ruby
=begin
|
|
File: vertex.rb
|
|
Created Time: 2024-04-25
|
|
Author: Xuan Khoa Tu Nguyen ([email protected])
|
|
=end
|
|
|
|
### 頂点クラス ###
|
|
class Vertex
|
|
attr_accessor :val
|
|
|
|
def initialize(val)
|
|
@val = val
|
|
end
|
|
end
|
|
|
|
### 値のリスト vals を入力し、頂点のリスト vets を返す ###
|
|
def vals_to_vets(vals)
|
|
Array.new(vals.length) { |i| Vertex.new(vals[i]) }
|
|
end
|
|
|
|
### 頂点のリスト vets を入力し、値のリスト vals を返す ###
|
|
def vets_to_vals(vets)
|
|
Array.new(vets.length) { |i| vets[i].val }
|
|
end
|