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.
Unfortunetly thats true, instruction is contradictory in one place
"negative-base number being one digit longer than its positive-base equivalent"
...
"For example, the representation for 6 is '11010' and -6 is '1110'."
Negativ is shorter here, so people are disoriented. I am.
Same here, I don't get the instructions. Sry
Instructions aren't clear, probably because neither example looks like it's using one's or two's compliment. How is +6 equal to '11010'? Shouldn't it be '110' or '0110'?
Though, -6 being equal to'1110' makes sense if you're using one's compliment.
What does 1 and -1 look like? What does 2 and -2 look like? What does 3 and -3 look like?
Nevermind...negative base number systems. Missed that info.
Well done ;-)
Solution was to change !value to typeof value === 'undefined'.
When an element was 0, it was exiting the fn prematurely.
myjinxin2015, How are you formatting code in the comments?
Thanks for all the help! Your question about !value is for the case there's only one element in the original array.
Since, as you've correctly pointed out, sorted.shift() changes the array length, value will be undefined so this allows the function to exit with the correct value.
I should go to bed, so many suggestions for the time being.
another wrong(maybe) is there:
!value || last !== value
I don't know
!value
mean, but I know if value==0 what will happen ;-)another wrong is there:
var value = sorted.shift();
if you used shift(), your array length will changed, and you use for loop, i<=len should got some undefined value
another wrong is there:
for(i=0; i<=len; i++){
i<=len
should bei<len
sorted[len] ====== undefined
I think it because you modified the original array.
the first line maybe write like this:
var sorted=A.slice().sort(doSort)
I can't sunmit your code now, CW running slowly...
This comment is hidden because it contains spoiler information about the solution
paste your code here is a good idea ;-)
Don't forget mark as having spoiler content
It's odd, I keep getting different results for the submit tests. Sometimes I get 1 fail, sometimes 9 fails, sometimes 4 fails. But the tests I've written are consistent. And since there's no output for the tests other than 'failed' I cannot figure out WHY those tests fail.
Are you sure the tests that are being generated are correct?