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 like this solution:
This comment is hidden because it contains spoiler information about the solution
If I log out the input array after the method has run, I get the same as before, i.e. the input is not changed.
Well, yes: hurts to look at...
but every other solution (including my own) does so too: fiddling with minus and space and bla
Still some nice things to learn from this one...
This comment is hidden because it contains spoiler information about the solution
Perhaps I'm to picky here: like most of the solutions You reformulate the conditions, i.e. You calculate the negations somewhere, in Your head or a sheet of paper and test for these calculated conditions - which in this case is easy enough. In general I don't think that this is advisable: it is prone to error, and everybody maintaining your code has to do these calculations in order to check if they are equivalent to those in the specification. I think it is better to test for !(h>0) as specified, instead of testing for (h<=0).
This comment is hidden because it contains spoiler information about the solution
Ok, I would have thought that You are proficient, because of the prime-number stuff... Unfortunately I do not know about a way to generate primes, i.e. every algorithm like yours has the limitation of just finding the right answer for the primes you included - and for all of their possible products of course. Probably execution-times are very low, since you are only checking for the primes.
My own algorithm is much worse - though it passed the auto-grader... But - in the end we are here for learning, aren't we?
Is it genius ? Is it madness? - I would refuse to maintain such code. If I absolutely had to, I would delete it and start afresh, not wasting my time to try to understand it. At least a few comments to explain what is done should be given.
Yes, You are right - realized this the other day, but could not find my comment to Your solution to correct myself.
n=2048 : should [2, 11] ---> get: None
Nice idea to use prime powers only, but keeps the algorithm from working when k consists of primes not in your list.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
page_index() seems to be wrong:
helper = PaginationHelper(['a','b','c','d','e','f'], 4)
print(helper.page_index(4)) # should == 0 (zero based index) ----> get: 1
Loading more items...