Files
hello-algo/ko/codes/ruby/utils/vertex.rb
T
Yudong Jin 2f561d3d51 feat(ko): add the Korean online edition (#2006)
* feat(ko): add the complete Korean online edition

* Use UTF-8 for Python CI output on Windows

* Remove print-book promotion from the Korean site

* fix(ko): preserve emphasis before Korean particles
2026-10-29 03:46:43 +08:00

25 lines
520 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