Skip to content

Instantly share code, notes, and snippets.

View laurenachoo's full-sized avatar

Lauren laurenachoo

  • Vancouver, BC Canada
View GitHub Profile
def range(a, b)
a.upto(b) { |x| puts fizzbuzz(x)}
end
def fizzbuzz(num)
if divby3(num) && divby5(num)
"FizzBuzz"
elsif divby5(num)
"Buzz"
elsif divby3(num)
@laurenachoo
laurenachoo / README.md
Last active August 29, 2015 14:20 — forked from kvirani/README.md

The Yuppie Vancouverite

The Yuppie Vancouverite needs to rent an apartment downtown!

Here we have a rent? method that helps them decide if they are going to an apartment based on some information about it. It's passed 3 key pieces of information that are used to determine this:

  1. Is the apartment furnished? Since this is a yes/no thing, it's a boolean (true/false)
  2. Is the apartment baller? Since this is a yes/no thing, it's a boolean (true/false)
  3. The monthly rent for the apartment. This is expected to be an integer (Fixnum)
@laurenachoo
laurenachoo / README.md
Last active August 29, 2015 14:20 — forked from kvirani/README.md

Create a directory in your /vagrant folder (while ssh'd into your Vagrant VM). Within that directory, clone your fork of this repo, which contains one ruby file max.rb.

Spend the time necessary to read and fully understand what the code in max.rb is doing. Google or discuss as necessary. Have an expectation of what will be output when you first run the code, then use the ruby command to run the max.rb file from the terminal.

Task: Currently, the built-in Array#max method is being used (line 3) to implement the logic for the maximum method. As an exercise, instead of leveraging this built-in method, implement your own logic such that the maximum method continues to work the same way that it was, and the resulting output from this ruby script stays the same. Note: you also cannot use Ruby's built-in sort method.