Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Fixed, thanks!
return stairsIn20Years
is missing in the intial solution.see this to format your code
Approved, thanks!
Lua translation ready for approval (author deleted their profile)
hmmm... Yes I did not read the instructions correctly. I got a pass test for the basic test, but failed the random tests, and thats when I got confused and thought it was asking for random number of years. I will try again. Thanks
You're getting NaN because your function doesn't work with the tests. The tests are going to call your function
stairsIn20(number)
and the tests are going to pass that function one argument: an array of arrays. Ultimately, what is happening is that you are trying to returnstairs
, which you have already defined, multiplied bynumber
, but in this case,number
is actually the array of arrays that the tests have passed to your function. An array * integer results inNaN
.I think you may want to read the description again, because based on your code, it seems to me that you think the tests will pass a number of years to your function which you then have to return as the x-year estimate based on the number of steps in the example. The goal is to always produce a 20-year estimate of the number of steps taken, and every individual test will pass a different amount of steps in the form of an array containing a different array for each day of the week as an argument to your function.
This comment is hidden because it contains spoiler information about the solution