Skip to content

Instantly share code, notes, and snippets.

View j4rs's full-sized avatar

Jorge Rodriguez j4rs

View GitHub Profile
@j4rs
j4rs / solution.rb
Created September 8, 2023 16:05
Max word letter span problem
# Given some text, write a function to find the max word letter span and list of words with that span
# Word letter span is defined as the alphabetical distance in between the first and last letters of the word
# Rules
# The same two letters produce the same span regardless of their order in the word
#. “PAT” and “TAP” have span 4
# Capitalization does not matter
#. “Pat” and “pat” have span 4
# Words that begin and end with the same letter have a word span of 0