Last active
January 26, 2018 05:45
-
-
Save bdougie/ae926e797416c434c1396a474e2d3d5a to your computer and use it in GitHub Desktop.
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
# the problem is return the wrong answer, set a breakpoint to find out what is wrong | |
def powersOfTwo(n) | |
newArr = [] | |
(0..n).to_a.each_with_index do |x, i| | |
# set a print to see what s happening | |
newArr.push(2*i) | |
end | |
newArr | |
end | |
# powersOfTwo(2) | |
# [1,2,4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment