Last active
August 29, 2015 13:56
-
-
Save LNA/9328332 to your computer and use it in GitHub Desktop.
Clues In Test Driving Solutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it “returns first n numbers” do | |
# I know there are a few ways to approach this. I could chose a while loop and use a counter to track how many indexes I have counted through. However, I would go for a range. It gets the job done with less code. Less code is good. | |
end | |
it “returns a portion of a given group in the form of an array if some condition is met” do | |
# use find_all. | |
end | |
it “returns two arrays: one for a false condition” and it “returns two arrays: one for a true condition” do | |
# use partition. | |
end | |
it “sums the numbers of an array” do | |
# use array.inject(:+) | |
end | |
it “adds numbers to an array based on doing a mathematical calculation to the number before it” do | |
# means you will be using a count, setting it to zero, iterating through an array to perform some function on its elements and adding to that count through each iteration. | |
end | |
it “checks each element in an array against some logic and selects the elements that return true” do | |
# use select | |
end | |
it “performs some logic on each element of an array and returns the results as a new array” do | |
# use collect or map | |
end | |
it “checks if all elements of an array are alike in some way” do | |
# use all? | |
end | |
it “returns all elements of an array that match a series of letters and/or numbers” | |
# use grep | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment