Skip to content

Commit 7100a9d

Browse files
authored
Merge pull request #493 from fartem/819_Most_Common_Word-update-2
2024-02-05 v. 4.3.7: added "819. Most Common Word"
2 parents cd0c756 + 807bb64 commit 7100a9d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

leetcode-ruby.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require 'English'
55
::Gem::Specification.new do |s|
66
s.required_ruby_version = '>= 3.0'
77
s.name = 'leetcode-ruby'
8-
s.version = '4.3.6'
8+
s.version = '4.3.7'
99
s.license = 'MIT'
1010
s.files = ::Dir['lib/**/*.rb'] + %w[bin/leetcode-ruby README.md LICENSE]
1111
s.executable = 'leetcode-ruby'

lib/easy/819_most_common_word.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ def most_common_word(paragraph, banned)
1010
word = []
1111
counter = 0
1212
words_with_count = {}
13-
in_lower_case = paragraph.downcase
14-
(0...paragraph.length).each do |i|
15-
c = in_lower_case[i]
13+
paragraph.downcase.each_char do |c|
1614
if is_letter?(c)
1715
word << c
1816
else

0 commit comments

Comments
 (0)