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.
This comment is hidden because it contains spoiler information about the solution
Regex seems to have become contentious. I learned it long ago, and it's useful across several languages. But I don't think it ever made the difference in whether or not I got a job, and using it first just because I knew it tended to prevent me from learning language tricks and features as I'd just go find "how do I do regex in Python/JS/Ruby/C#/whatever" instead of how to solve the problem with native tools.
It's also not a thing every programmer knows, and regex can be hard to read and decode later which makes it not an ideal thing to use.
I think anyone learning a language can safely ignore regex. But that statement will upset a lot of regex fans.
I went brute force on this one...I should have compared the min/max lengths of each array to each other. Oh well.
Um, suddenly I'm not sure why this works. Why is a not false on the first iteration? I guess the first element is being passed, so I guess that works, but it's...messy at best. I should have added true as a second parameter to reduce.
Ok, I didn't know :capitalize. I was looking through the docs for "case" hoping to find "firstcase" or "camelcase" or something.
I hadn't done any Ruby in a while and felt satisfied with this until I saw the better, more idiomatic answers
This one beats many of the others because it uses the triple bit shift operator to ensure the int32 is unsigned.
I started with a simple bit shift count which passed the tests but failed random "attempt" tests that were larger than 32-bit max. Apparently bitwise operators return 32-bit numbers. I went to BigInt, but while >> works,
bigint & one
would throw an error, hence the modulus with two. Weird behavior.I tried something very similar. The tests passed, but the "attempt" failed on numbers greater than 32-bit max because the bitwise operators only know 32-bit numbers. This would fail the attempt today. I didn't know about the 32-bit limit before, so lesson learned.