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.
You're welcome! We're all in the same boat here - studying and practising.
Your solution is the most upvoted, so I chose it to leave a comment to give other people clue that there might be different, arguably more optimal approach.
Yeah You're Idea suits it better,(the idea of using a ring is just out of the box). I mean mine are you kidding it is just trash code, not fit for production - I'm learning GO .. and it's a good thing to learn from developers like you,
Thanks for the better answer I really appreciate that!
Aren't there too many memory allocations? We remove elements from the middle of the original
items
all the time.IMO circular list fits better.
My solution is the same. But I use static result slice size. It gives me almost 2 times better performance. Example benchmarking for my and your code:
BenchmarkJosephusDmitryermichev-4 5081414 207 ns/op
BenchmarkJosephusRobinDeNeef-4 3175298 376 ns/op