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.
The input arrays are not unsorted.
Thanks!
My mistake. Fixed in the fork.
I've approved this one, so at least it's somewhat functional, but the feedback for random tests is very poor. I tried running my incorrect solution and the only thing I see is this message in red:
Is there a way to improve this feedback?
Fixed in the fork. It was a result of backtracking, but for some reason it didn't affect my solution. I've placed cuts at the end of most of the test predicates.
Could you please address the issue that's raised on this kata's discourse section? Random tests don't seem to work.
not not id(object())//3%2
btw, I'm aware this isn't at all random, my initial version of this was an instance of malicious compliance with the tests. In fact, you can make this method perform hilariously badly:
In [1]: d = {True: 0, False: 0}
In [2]: for _ in range(1000000): d[not not id(object())//3%2] += 1
In [3]: d
Out[3]: {True: 0, False: 1000000}
In [4]: for _ in range(1000000): d[not not id(object())//3%2] += 1
In [5]: d
Out[5]: {True: 0, False: 2000000}
In [6]: for _ in range(1000000): d[not not id(object())//3%2] += 1
In [7]: d
Out[7]: {True: 1000000, False: 2000000}
You can't do this... Function id() always returns the even number. Your function is not random and always return True.
A typo in Solution setup:
human_years_cat_yeras_dog_years
should behuman_years_cat_years_dog_years
.Approved. Thanks!
ooooh that's nice.
The reason you cant approve is that another translation seems to have been approved, or for some reason the description has changed since this translation was made. The translation can simply be forked, which should update it to the newest description (potentially with some merge conflict to be resolved), and then approval should work.
Why are you asking to return
0
when no number exists? Prolog handles such cases by merely having the predicate fail, returning0
is strange. If you really must return a value (which I discourage) then it should be-1
inline with other languages.Sorry, can't approve. System doesn't allow me: gives an error message 'recent changes from related record must be merged first'.
No idea how to do that.
I think your previous solution was more efficient, this one keesp repeatedly searching the lowerbound, the prior compared as interleaving
Loading more items...