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.
Math.sign(num) will return -1 if the number is negative I think.
The solution itself is simple once you understand and solve the puzzle. The description is good, but only one part was confusing me. I misunderstood the communication part. I thought by communication it meant that they 1 can tell 2 & 3 their hat colors. That threw me off track for a bit. Once I understood that they can only guess their own hat I understood it was more of a probability problem. I hope this helps others who had the same confusion.
OMG!!! I spent so much time thinking the addresses needed to be sorted by street names then street numbers. The kata turned out to be so much easier than I thought :)))
Thank you so so much for your help!!!
For some reason I don't seem to get how addresses within the required zipcode are being sorted.
From what I understood, I am supposed to sort them by street name then street number, but some of the random test cases are coming back with errors that prove my understanding wrong. Can someone please explain to me what am I missing? Here's a sample test case that yields an error:
expected 'OH 43071:Main Long Road St. Louisville,Main Street St. Louisville/432,123'
to equal 'OH 43071:Main Street St. Louisville,Main Long Road St. Louisville/123,432'
According to my sorting logic, Main Long Road should come before Main Street, which is the case. But according to the expected result it should have been the opposite.
Can anyone explain to me why is that? Am I getting the sorting logic wrong?
It took me a while to figure out why my solution wasn't working. As soon as I remembered there was a trick, I got it! Realizing the trick put a big smile on my face! Seriously, common sense! Well done!
There is one use case that I do not understand. How can the left half and the right half of the array weigh the same if there is one ball heavier on either sides?? When I call the scales.weight function comparing elements 0-3 and 4-7 in some cases I get 0 which means they weigh the same, shouldn't the sum of ball weights with one heavier be more than the sum of the rest that weigh the same. This is driving me crazy. Can someone explain it to me please? Thanks I really appreciate it.
I tried it. It didn't work. It runs out of memory. Too many function calls for the call stack to handle.
I get it now!
Thank you so much :)
I'm still getting some errors that I do not understand.
For this input: [ 1, 4, 2, 3, 5, 4, 5, 6, 7 ] I got this error:
expected [ 1, 3, 5, 4, 5, 6, 7 ] to deeply equal [ 1, 4, 2, 3, 5, 4, 5, 6, 7 ]
The code I wrote gives the first array. Shouldn't the [4, 2] be removed from the sequence, as my code did? The expected answer has not removed the longest even sequence (the predicate is testing if number is even). Did I misunderstand the problem? What am I missing?
Thank you so much. That's very helpful. I appreciate it.
I need some help.
I got the hex number to convert correctly to base64.
My problem is with the padding. I thought I understood the concept, but I sill don't get when does it need 1 '=' and when does it need 2 '=='.
Thank you so much. I had completely misunderstood the problem. It turned out to be so much simpler than I thought :)
Thanks.
I'm confused about this problem. According to my understanding, this use case [[1,4,2,3,5,4,5,6,7],[]] should yield [4,2] as the longest even sequence. Why is the expected result []. Could someone explain to me what am I missing?
I would really appreciate it.
Thanks.
I didn't know that!
Thank you so much :)
That is very helpful.
This comment is hidden because it contains spoiler information about the solution
Loading more items...