Skip to content

Instantly share code, notes, and snippets.

@dedemenezes
Created July 18, 2024 19:39
Show Gist options
  • Save dedemenezes/c80af56a4ca8fcd7ce5dfa6e304b59d1 to your computer and use it in GitHub Desktop.
Save dedemenezes/c80af56a4ca8fcd7ce5dfa6e304b59d1 to your computer and use it in GitHub Desktop.
# 1. Define alphabet array
# 2. Split string into array of letters
# 3. Iterate over letters array
# For each letter
# 4. Shift letter three letter behind in the alphabet
# 4.1 Identify the letter index in the alphabet
# 4.2 Subtract 3 from index
# 4.3 Access new alphabet letter
# 6. Join shifted letters array into string
# puts encrypt("THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG") == "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment