Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion leetcode-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'English'
::Gem::Specification.new do |s|
s.required_ruby_version = '>= 3.0'
s.name = 'leetcode-ruby'
s.version = '8.2.5.6'
s.version = '8.2.5.7'
s.license = 'MIT'
s.files = ::Dir['lib/**/*.rb'] + %w[README.md]
s.executable = 'leetcode-ruby'
Expand Down
7 changes: 4 additions & 3 deletions lib/common/binary_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ def self.are_equals(curr, other)

return false if !curr || !other

curr_eq = curr.val == other.val
return false unless curr.val == other.val

left_eq = are_equals(curr.left, other.left)
right_eq = are_equals(curr.right, other.right)

curr_eq && left_eq && right_eq
left_eq && right_eq
end

# @param {Integer[]} nodes
Expand All @@ -39,9 +40,9 @@ def self.build_tree(nodes)

while i < nodes.length
current = queue.shift

next unless current

# Left child
if i < nodes.length && !nodes[i].nil?
current.left = ::TreeNode.new(nodes[i])

Expand Down
Loading