Skip to content

Instantly share code, notes, and snippets.

@bjvoth
Created June 1, 2016 21:58
Show Gist options
  • Save bjvoth/95067879ef9a9ec63b788ffbcf5e3612 to your computer and use it in GitHub Desktop.
Save bjvoth/95067879ef9a9ec63b788ffbcf5e3612 to your computer and use it in GitHub Desktop.
Codewars problems
PROBLEM 1:
Write a method that takes a maximum bound and returns all primes starting with 0 up-to and including the maximum bound.
For example:
Should return an array that looks like this:
[2,3,5,7,11]
def prime(n)
# Generate an array containing every prime number between 0 and the num
# specified (inclusive)
end
PROBLEM 2:
class Array
#your code here
end
Complete the method (or function in Python) to return true when its argument is an array that has the same nesting structure as the first array.
For example:
# should return true
[ 1, 1, 1 ].same_structure_as( [ 2, 2, 2 ] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment