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.
Hi there!
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_AND
This explonation was took from 'JohanWiltink'
It evaluates as (a & b) & ((a & b) - 1).
Let c = a & b, so you have c & c-1. That clears the top bit, if any, from c. If c == 0, a and b had no set bits in common. Otherwise, if c & c-1 == 0, a and b had exactly one set bit in common. In all other cases, they had at least two set bits in common, and the function should return true.
You can use c & c-1 iteratively to zero out all set bits from c. That's a faster way to count them than to count set bits over all of them.
Can someone explain how this work ?
I understand the syntax but not why this actually work
Hmmm... now I see... NO THING! HA!
a poor solution is to push multiples into an array, which fills the memory buffer and crashes. then, using a counter took me further, but that timed out after 12 seconds. finally, I tried a generator to economize memory usage. but the way a generator is structured, I was unable to pass
n
tosolution()
without hardcoding then
value.You don't have to use 2 reduces regardless. You can access array elements with their index. You are doing a bunch of unnecessary stuff like concat and that ternary...
There are 263 javascript solutions ranging from 1 to 50+ lines. There are many valid ways to solve this one.
Uwwwh, can you use only one reduce thanks to destructuring ? Very clever if so, I have to use 2 reduce instead.
What kind of sorcery is this ? Could you explain ?
Ok thank you for your explanation, I don't get the logic yet but I will think about it in future katas !
'Y' is sometimes considered a semivowel, but when only two categories (vowels / consonants) are considered, 'Y' is usually categorized as consonants.
This comment is hidden because it contains spoiler information about the solution
Can't get anything of this piece of art ! Can you explain ?
Very beautiful :)
This beautiful ascii art do not work for the year 12542.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...