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.
Simple bitwise operator
number & 1 === 0 // even
number & 1 === 1 // odd
The function name could be something unique, rather than the name of a pre-existing builtin function. Working in IDEs will give unintended result.
I am very curious how your solution passes tests on your PC with the same data if it does not even solve the right problem?
Your solution would work with regular Python lists (well, almost, it would fail for some cases), but it will not work for generic linked lists.
Your solution tackling wrong problem is not a valid kata suggestion.
Code passes all pytests on my PC with the same data, but doesn't pass even one test on codewars.
It's becaus I don't take in account that:
"The linked list is defined as follows:
class Node:
def init(self, data, next=None):
self.data = data
self.next = next
Function should return root node, but in description not specific that.
nice kata, had me searching and overthinking before coming to a simple solution (clojure)
description amended
I rewrote the JavaScript tests suite, as well as enabled Node 18 + chai assertions. the test suite now includes edge cases (almost-sorted arrays, sorted arrays of length 2)
the error comes from your code, at this line:
if
array[1] == array[0]
, this divides by0
, thus raising aSIGFPE
as of now, TypeScript 4.9 is the only version available
duplicate of this issue
fixed
re-raised there as an issue
re-raised there as an issue
https://docs.codewars.com/training/troubleshooting/#c-c-signal-11---sigsegv
for some inputs, control flow can leave your function without returning any value, so your code effectively returns random memory addresses in those cases. this is visible if you add
return "???";
at the very end of your functionLoading more items...