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.
once you understand the description it's quite simple to solve. quite fun though, i like this kata
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.
Kata hint != kata suggestion
I copied and recived true: travel(r, zipcode) === "AA 45522:Paris St. Abbeville,Paris St. Abbeville/67,670" Problem only with this test. The other are passed
check you don't add a trailing space
WTF???
expected 'AA 45521:Paris bd. Abbeville,Paris St. Abbeville/674,67' to equal 'AA 45521:Paris bd. Abbeville,Paris St. Abbeville/674,67'
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!!!
Hi,
there is no sorting invloved. You keep the order of the original sentence.
.
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?
Your comment really helped. Thanks.
Nice Kata with pretty nice catcher :D
A very interesting and fun kata. First it makes you scratch your head until you realise what you've been doing wrong.
Loading more items...