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.
Nice solution! Would be better to reserve exactly 26 entries for each letter possible. Would also be better not to allocate a new hashmap every time frequency is called, even if not as terse.
there is no notion of private and public addresses in this kata, so yes, you have to count them
That's my understanding as well
I believe this is better than sorting, but not sure?
With n the size of a single word, sorting is
O(n * log(n))
, whereas counting should be onlyO(n)
.Could you elaborate how does this relate to RFC 1918 - Address Allocation for Private Internets?
Should we count IP addresses in those ranges?
Might have overcomplicated this due to misunderstanding the "first pair" definition initially. Well at least I've learned a lot.
Should have used
mapv
instead ofmap
? Does it make a difference here?I didn't have the patience to think the cases through. Shameless brute-force solution with applicative functors. On the other hand if the winning condition ever changes this will be easier to adjust than the other solutions.
oops
radialDist
should have beenouterDistance