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.
Oh duh. Pardon my momentary lack of reading comprehension, I have been fighting the flu.
Am I the only one who thinks returning -1 for non-existant town is a bad idea? Considering it's possible to have a mean temperature of -1? It may be a very unlikely scenario, but possible for certain cities in artic regions.
Only thing I don't really like about this solution is the double call of sqrt.
I didn't fully look at the example in the description. Had I done so, I would have seen to exclude leading zeros instead of racking my brain why it kept getting wrong answers. On another note, java's Integer class makes this entirely way too easy.
How is this even possible without knowing which bottles were given to each rat? I have never been so utterly lost by a puzzle in my life.
I have never touched Ruby before. Still, only took about 30 seconds to write an solution. And then 30 minutes figuring out how to raise an exception without getting an error. In the end, I gave up and forfeited because everything I tried gave an error. Turns out, I wrote the exception correctly all along, I just checked the integer against 0xFFFFFF instead of 0xFFFFFFFF. FML.
Well, I failed. By failed I mean had to look up a few tips. I had heard of this necessary class we needed to use, but I had never actually used it before. Had no idea I could stuff like that to another class. Frustrating due to the lack of initial direction but I did learn something out of it, even if I had to seek out a little help to get started.
Guilty of that myself, simple fix though.
Your code can never return index 0.
pageCount() is incorrect. Imagine an item count of 50 with 10 items per page. You'd end up with an extra empty page.
Most of these, including mine, would fail if the sentence contained more than a single space in a row.