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.
Was able to copy-paste your done into Ideone and get it working after removing the JQuery-style "${}" elements and it returned [1, 7] as expected.
I'd say double-check the output with print statements just in case.
The Kata specifications outline the behavior that makes your current interpretation invalid, since the paired numbers 3 and 7 appear to the right of an alternate complete pair. Try a new solution that follows that spec!
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.
Mind sharing your code? You can mark it as a spoiler and we can help take a look to see where your approach is eating up time.
It may be that the tests are expecting a specific named function to be defined, but the compile process is determining it hasn't been defined/created.
Have you tried renaming your function to 'sum_pairs' to see what happens?
Can you provide more information here? The examples and details on the Kata explain from the get-go the types of cases that will appear, as well as the fact that there will be a need to write an efficient algorithm due to the requirement of having to handle lists with 10 million elements.
I'm late to respond to this, but after taking a look at the mere fact that you went and made a COBOL translation and that it (presumably) works, I felt a deep fear like writing up a post-mortem for a cancelled year-long project.
I personally don't have the expertise required to gauge if the translation is good enough, so I'll defer to people more intelligent than me to make that call.
I bow to your knowledge of the Old Ways.
I respect your opinion.
For many people, this problem has appropriate wording, while for others it's misinterpreted. In real-world scenarios, being able to reach out and discuss with others and doing investigation is what makes a difference between a substandard and a great developer.
This requirement was removed. My solution checker handles the nested list appropriately to ensure lists like the following are considered equivalent:
Ah, I believe you're correct, at least in regards to the worst possible runtime.
After looking into it, this seems like a rendition of the Knapsack problem, which is NP-complete—specifically, as a 0-1 knapsack problem.
However, there are psuedo-polynomial runtime approaches to the problem using dynamic programming, and this approach lands a runtime between O(nW) [where W is the word limit] and O(2^n); meanwhile the space requirements are only O(nW)
See the example here https://en.wikipedia.org/wiki/Knapsack_problem#0-1_knapsack_problem
I was hoping for a runtime like the famous Word Break problem (check if a string can be made up of any combination of provided dictionary words), which is O(nlogn), IIRC.
A pure brute force solution would require O(n!), since you would need to check every combination of books possible per book checked.
With some memoization or clever arrangement of the problem parameters to avoid revisiting elements, I believe the runtime goes down to O(n^2) (with the true complexity being n(n-1)/2).
EDIT: The runtime values determined here are incorrect. Please see the thread directly above this one.
There are two examples of that in the visual representation breakdown. A set of one object is contained within a larger set of two objects, so it is ignored.
A set of one object is still a set.
Ok? Thanks for your feedback. Not really a suggestion though.
Thanks for the suggestions! I've gone ahead and made a visual representation of an example problem pass, and included some examples without the visual aids at the bottom of the problem description.
Let me know if there are better ways to introduce examples to a user or if you have any other recommendations for this problem! :)
Thought about using a memoized approach here, but wound up with a rather brutish approach IMO. Given that less intensive Word Break problem is often O(n^2) time, this might just be a known issue with solving these combination-type problems.
Loading more items...