Skip to content

Instantly share code, notes, and snippets.

View shadoi's full-sized avatar

Blake Barnett shadoi

  • Apple
  • San Francisco
View GitHub Profile
# Write a method that takes a string in and returns true if the letter
# "z" appears within three letters **after** an "a". You may assume
# that the string contains only lowercase letters.
#
# Difficulty: medium.
# may want to do max+1 as base-zero can be confusing
def x_after_y?(str, char1, char2, max)
range = Range.new(1, max)
str.slice!(str.chars.index(char1))
class Test
def initialize
@atts = Hash.new
end
def prop=(value)
@atts[:prop] = value
end
def prop