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.
according to the Kata 4041000 is 4*(6!)+4*(4!)+3! == 2982
The index is counted from zero upward.
Because python that's why lol
This comment is hidden because it contains spoiler information about the solution
It's part of the python standard library, so it's not.
recursion is neat
Chrono79 made the basic point, but I'll also chime in here. Consider massive data optimization as something that can help your resume! There's a big difference between an engineer for a local small business who can manage thousands of users' data a month versus an engineer who can optimize for thousands of requests per minute. That's the kind of difference that lets someone work for a AAA company or not.
I would argue that in this particular scenario the Stack Class its perfect; From the documentation itself "A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class.", yet in this scenario all of the extra features available with Deque will not be used, a simple stack data structure is more than perfect for this scenario.
I'm a bit confused about the challenge. The first test case is for "4041000" to resolve into 2982. According to the rules of the Kata, that'd be 4*(7!)+0*(6!)+4*(5!)... and so on. However, 7! alone is already 5040, so "4041000" can't possibly be the solution.
What am I not understanding?
Read the description again:
Also, it has a
PERFORMANCE
tag, what more do you need?My God what a frustrating Kata. It's again one of those, "your solution might work for 100k items but we're testing 5 Million".
I wish katas that are purely complicated because they require some esoteric levels of optimization would be tagged as such.
This comment is hidden because it contains spoiler information about the solution
You shouldn't; defeats the spirit of the game.
I think that is the programming part here, discovering the math and then implementing it. Looking at the wikipedia page, you're not going to reinvent that through trial and error.
The formula given is a recursive one, which will break, so your programming challenge is how do you make it non-recursive.
Well, I GUESS that's an option too.
Such an elegant solution. Never heard of Stack class, thank you.
Loading more items...