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.
Rejected due to following reasons, also
_
should be added in parameters of initial solution setup and author's solution since there is no point of using named parameters hereIt doesn't work for me due to 12s timeout.
Thanks for submitting a Swift translation for "do i get a bonus". I'm helping review them but I don't have privileges to approve/reject.
Sample test cases:
Get rid of the comment at the top (Example/TODO)
You need multiple sample test cases. All you currently are doing is assering that 1 == 1
Test cases:
Rename testExample() to testFixed()
Add a few more fixed tests
Add random tests where you randomly generate the salary and whether bonus is true
your function name bonus_time() should be renamed to bonusTime() to conform with Swift function naming practices.
In tests consider giving meaningful feedback by adding a third parameter. Here's one of mine from my "six toast" Swift translation:
XCTAssertEqual(sixToast(4), 2, "Incorrect answer for num = 4")
(where num is the function parameter name)
For reference, here's my "Swift translation checklist" that (usually) gets me past a moderator's reviews:
A positive integer is an integer greater than 0.
But if you want to be sure, then yes you could validate the input too. Not needed here tho.
If anyone accidentally calls divisors(0) then this will crash. There needs to be a check like:
guard n != 0 else { return 0 }
However I'm not sure what you should return. Returning 0 would technically be right. 0 has 0 divisors since 0 can't be divided.
This is not a best practice. If you are testing the number 1000, you are applying
n % $0 == 0
499 times more than needed.That won't happen, since
1 <= month <= 12
(see description)Looks cool and short, but if month will be equal 15, you'll get 5...
Would you mind to elaborate? It's almost the same solution in C.
everything brilliant is simple)
Why would .to_i be necessary? The array consists of integers only.
Sorry but even though this seems to pass the tests, the attempt looks wrong to me.
Let's say the the hero has 5 bullets and 2 dragons to fight. This solutions returns 'false' then, even though the hero has enough bullets (he only needs four).
Maybe I'm overlooking something here, but it misses the point of the instruction and doesn't do what is asked for.
Nice! I think you could even omit "return".
Yeah absolutely sexy, this also prevents nasty user input because it enforces the use of a certain datatype. Thanks for the upload!
This is just beautiful to look at. My personal favourite!