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.
I submitted the solution above and one slightly refactored variation 9 years ago. I definitely did not copy from StackOverflow and I claim my solution original. I have no idea how a number of people came up with the exact solution of mine. Note that you can see other solutions once you solved a kata. Interestingly many of the accounts above where suspended.
It does not matter. Any modern C compiler can optimize abs(x) and x < 0 ? -x : x equally. gcc 12 compiles both into the exact same code sequence.
No expensive at all in the grand scheme of things. This is Python, it is slow to begin with.
This comment is hidden because it contains spoiler information about the solution
It does not matter. In python there is only one integer 0. -0 and 0 is the same thing.
sqrt() is computed using floating point is prone to precision error. Without round(), int() just truncates the result. If you result of sqrt is 1.9999999, int(1.999999) will be 1 instead of 2.
This comment is hidden because it contains spoiler information about the solution
Test case is broken: In 'The quick br----he lazy dog', the first part is 12 characters and the second 11 characters. The question says that the second part should be longer if glue cannot be place exactly in the middle.
function names in python answer template and test template are not the same.
This comment is hidden because it contains spoiler information about the solution
Instructions say "increases by a fixed 0.5 percent at the end of every two months."
but that example have rate of loss changing by 0.5% every month:
"End of first month percent of loss: 1, end of second month percent of loss 1.5, end of third month still 1.5, end of 4th month 2 and so on ..."
Please fix either one.
Python test case and uses get_num but code template uses getNum.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Is the submission test broken:
Falsifiable (after 3 tests and 4 shrinks):
expected: Just 0
but got: Nothing
[0]
Positive {getPositive = 1}
-1
-1 is not valid and I expect Nothing is the correct answer instead of Just 0
Loading more items...