feat: Add Ruby code - chapter "computational complexity" (#1212)

* feat: add ruby code - chapter computational complexity

* feat: add ruby code blocks
This commit is contained in:
khoaxuantu
2024-04-03 04:10:25 +07:00
committed by GitHub
parent df83b869eb
commit fd580a184a
9 changed files with 581 additions and 4 deletions

View File

@ -0,0 +1,18 @@
=begin
File: tree_node.rb
Created Time: 2024-03-30
Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com)
=end
### 二叉树节点类 ###
class TreeNode
attr_accessor :val # 节点值
attr_accessor :height # 节点高度
attr_accessor :left # 左子节点引用
attr_accessor :right # 右子节点引用
def initialize(val=0)
@val = val
@height = 0
end
end