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.
Haha I almost forgot this method(ty for reminding)
Amazing idea
"First" and "longest" are superlatives that do not necessarily reflect the same element in a sequence.
After some consideration, I believe the confusion arises from a very common unawareness of how a superlative can apply to more than one element. However, to more easily interpret it this way, there has to be a plural somewhere.
For that reason, "first longest string" is easily (mis)interpreted to mean "the first string longer than any preencountered string", because there is no hint of plurality.
Hence, I think the criteria "first" and "longest" are confusing and in need of qualifiers, i.e. "first string among those that are the longest length", which is much harder to misinterpret.
The code that is output if one prints it seems to differ from what code is actually being run, or there's an issue with copy/paste. I've tried copying into external editors only to find whitespaces missing. I believe that copying directly (at least on my system/browser) omits leading whitespace on lines, so I had to manually count the number of spaces and insert them.
Another possible cause of infinite looping (check the stack contents) is the order of operands in the non-commutative binary operators. If
-
is carried out asa-b
the result is an infinite series of-7,8...
accumulating in the stack. I ran into this and found out only after looking at the stack and my interpreter passed the test once I fixed this detail.I almost finished this the day I worked on it, had to call it quits for the day, came back the next day, finished my solution, pasted it in. It passed visible tests (and the submission tests) but then encountered an error when I tried to submit final. Now all I get when I submit is a message that the solution is withheld because "you have not solved this kata yet."
What's going on here?
490 cakes? (Actual number encountered during random tests)
We'd both die of overeating.
This is definitely a challenging problem that requires above-average skill in algorithm design, if the solution is required to scale like this and still run all tests in under 6 seconds.
I thought I had a decent solution that scaled a lot better than O(2^N) (my first working solution before improvements) until it hit random testing and all hell broke loose.