While doing the app academy practice for my interview, I wrote the following bit of code for the 04_wonky_coins. It passed all the tests, but it didn't really seem right:
def wonky_coins(val)
return val*2 + 1
end
I compared it to code given in the solution, and sure enough the answers started to deviate at coin values of 6 and above.
I added a test for this case in the spec, so that the above function will fail.
While doing the app academy practice for my interview, I wrote the following bit of code for the 04_wonky_coins. It passed all the tests, but it didn't really seem right:
def wonky_coins(val) return val*2 + 1 end
I compared it to code given in the solution, and sure enough the answers started to deviate at coin values of 6 and above.
I added a test for this case in the spec, so that the above function will fail.