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 .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

env:
RUBY_VERSION: 3.0
RUBY_VERSION: 3.3.6
SIMPLECOV_THRESHOLD: 100

jobs:
Expand Down
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 = '7.5.1'
s.version = '7.5.1.1'
s.license = 'MIT'
s.files = ::Dir['lib/**/*.rb'] + %w[README.md]
s.executable = 'leetcode-ruby'
Expand Down
4 changes: 2 additions & 2 deletions lib/common/linked_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def self.from_array(values)
# @param {ListNode} second
# @return {Boolean}
def self.are_equals(first, second)
return true if first.nil? && second.nil?
return true if !first && !second

return false if first.nil? || second.nil?
return false if !first || !second

first.val == second.val && are_equals(first.next, second.next)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/common/list_node_with_random.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def self.are_equal(l1, l2)
l2 = l2.next
end

l1.nil? && l2.nil?
!l1 && !l2
end
end
6 changes: 2 additions & 4 deletions lib/common/next_tree_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.are_equals(n1, n2)
return are_equals(n1.left, n2.left) && are_equals(n1.right, n2.right)
end

n1.nil? && n2.nil?
!n1 && !n2
end

# @param {NextTreeNode} other
Expand All @@ -40,7 +40,5 @@ def ==(other)
end

# @return {Integer}
def hash
[val, left, right, nxt].hash
end
def hash = [val, left, right, nxt].hash
end
4 changes: 2 additions & 2 deletions lib/common/node_with_neighbors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(val, neighbors = nil)
# @param {NodeWithNeighbors} n2
# @return {Boolean}
def self.are_equals(n1, n2)
if !n1.nil? && !n2.nil?
if n1 && n2
return false unless n1.val == n2.val

return false unless n1.neighbors.size == n2.neighbors.size
Expand All @@ -27,6 +27,6 @@ def self.are_equals(n1, n2)
return true
end

n1.nil? && n2.nil?
!n1 && !n2
end
end
Loading