Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 649 Bytes

mentoring.md

File metadata and controls

25 lines (16 loc) · 649 Bytes

Mentoring

Reasonable solutions

def isogram?(string)
  letters = string.downcase.scan(/[a-z]/)
  letters.uniq.length == letters.length
end

Common suggestions

  • Suggest using scan rather than gsub as it removes the need to break the string into chars.

Talking points

  • Comparing lengths (letters.uniq.length == letters.length) is marginally quicker than comparing letters (letters.uniq == letters) but its more code. Which is better?

Changelog

  • 2021 Nov - Markdown adjustment to style guide (sentences and links)