Skip to content

Commit

Permalink
Merge pull request #431 from fartem/1832_Check_if_the_Sentence_Is_Pan…
Browse files Browse the repository at this point in the history
…gram

2023-12-18 v. 3.7.6: added "1832. Check if the Sentence Is Pangram"
  • Loading branch information
fartem authored Dec 18, 2023
2 parents 000fb65 + c4cbe71 commit cc8a492
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,4 @@ Profile on LeetCode: [fartem](https://leetcode.com/fartem/).
| 1816. Truncate Sentence | [Link](https://leetcode.com/problems/truncate-sentence/) | [Link](./lib/easy/1816_truncate_sentence.rb) |
| 1822. Sign of the Product of an Array | [Link](https://leetcode.com/problems/sign-of-the-product-of-an-array/) | [Link](./lib/easy/1822_sign_of_the_product_of_an_array.rb) |
| 1827. Minimum Operations to Make the Array Increasing | [Link](https://leetcode.com/problems/minimum-operations-to-make-the-array-increasing/) | [Link](./lib/easy/1827_minimum_operations_to_make_the_array_increasing.rb) |
| 1832. Check if the Sentence Is Pangram | [Link](https://leetcode.com/problems/check-if-the-sentence-is-pangram/) | [Link](./lib/easy/1832_check_if_the_sentence_is_pangram.rb) |
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 = '3.7.5'
s.version = '3.7.6'
s.license = 'MIT'
s.files = ::Dir['lib/**/*.rb'] + %w[bin/leetcode-ruby README.md LICENSE]
s.executable = 'leetcode-ruby'
Expand Down
10 changes: 10 additions & 0 deletions lib/easy/1832_check_if_the_sentence_is_pangram.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require 'set'

# https://leetcode.com/problems/check-if-the-sentence-is-pangram/
# @param {String} sentence
# @return {Boolean}
def check_if_pangram(sentence)
sentence.split('').to_set.length == 26
end
12 changes: 12 additions & 0 deletions test/easy/test_1832_check_if_the_sentence_is_pangram.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../lib/easy/1832_check_if_the_sentence_is_pangram'
require 'minitest/autorun'

class CheckIfTheSentenceIsPangramTest < ::Minitest::Test
def test_default
assert(check_if_pangram('thequickbrownfoxjumpsoverthelazydog'))
assert(!check_if_pangram('leetcode'))
end
end

0 comments on commit cc8a492

Please sign in to comment.