Skip to content

Instantly share code, notes, and snippets.

@bparanj
Created July 19, 2021 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bparanj/159e1b06586647524cc14a35f1cd94a0 to your computer and use it in GitHub Desktop.
Save bparanj/159e1b06586647524cc14a35f1cd94a0 to your computer and use it in GitHub Desktop.
=begin
=end
def lookup_hash
h = {}
letter = 'a'
count = 1
for i in (1..26)
h[letter] = count
letter = letter.next
count += 1
end
h
end
def hundred_points(word)
lookup = lookup_hash
chars = word.chars
points = 0
chars.each do |c|
c = c.downcase
points += lookup[c]
end
return points == 100
end
p File.read('/usr/share/dict/words')
p hundred_points('QUARTER')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment