mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-22 00:07:13 +00:00
feat: Add ruby code - chapter "array & linked list" (#1158)
* feat: add ruby code chapter array & linked list - array.rb - linked_list.rb - list.rb - my_list.rb * feat: add ruby code blocks * chore: fix convention
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
=begin
|
||||
File: print_util.rb
|
||||
Created Time: 2024-03-18
|
||||
Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com)
|
||||
=end
|
||||
|
||||
### 打印链表 ###
|
||||
def print_linked_list(head)
|
||||
list = []
|
||||
while head
|
||||
list << head.val
|
||||
head = head.next
|
||||
end
|
||||
puts "#{list.join(" -> ")}"
|
||||
end
|
||||
Reference in New Issue
Block a user