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.
Cause it's very fast solution. But who cares about performance in 2k19 when a fridge has more cores and RAM than my PC. Sarcasm)
"WARNING: Segment may contain billion elements, to pass this kata, your solution cannot iterate through all numbers in the segment!"
the point of this kata is to come up with an idea how to calculate the result very fast without even going through the sequence and it requires making some observations about binary numbers
good luck! =]
Sometimes it pays to try unconventional approaches. This kata cries out for a graph-based solution, but this approach came to me when I considered trying them.
Glad you enjoyed it. Happy coding! :)
Edit: Wanted to share that I feel developers too often settle for their first working solution. This first working solution is often overly complex. They settle for this rather than refining it into something of beauty and elegance.
This comment is hidden because it contains spoiler information about the solution
Your grammar is slightly wrong.
Change
"no ones like this"
to"no one likes this"
Change
"likes"
to"like"
Change
"like this"
to"others like this"
in the statement"Alex, Jacob and 2 like this"
0 people = "likes"
1 person = "likes"
> 1 person = "like"
Make sure you read the output box properly.