#sample solution
def alphabetize(arr, rev=false)
if rev
arr.sort!.reverse!
else
arr.sort!
end
end
puts alphabetize(["b","a","d","c"])
puts #space
puts alphabetize(["b","a","d","c"],true)
def alphabetize(arr, rev=false)
if rev
arr.sort!.reverse!
else
arr.sort!
end
end
puts alphabetize(["b","a","d","c"])
puts #space
puts alphabetize(["b","a","d","c"],true)
No comments:
Post a Comment