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.
Gotta say, I like how the test cases in this one heavily discouraged an iterative solution - pretty neat!
Slightly Clearer Description
Task
You are given an array of string inputs
strarr
and an integerk
.Your task is to return the longest possible string that can be derived by combining
k
consecutive elements of the inputstrarr
.Example
longest_consec(["red", "orange", "yellow", "green", "blue", "indigo", "violet"], 2)
should return"orangeyellow"
Notes
In the case of there being multiple possible matches, only the first one will be considered correct.
In any of the following cases, the return value should be an empty string
""
:strarr.length === 0
strarr.length < k
k <= 0
The kata calls for a 'strictly increasing' sequence, where each value is distinctly greater than that which came before.
Since 1 is not greater than 1, your solution is not valid in the context of the kata.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Attempting to 'expand X replies' causes the message to disappear entirely instead of showing the replies.
Minor gripe: I feel testing over a 1,000 value array isn't adding much other than an excessive execution time to the kata. Especially since efficiency testing isn't part of the kata.
When viewing solutions for kata that I've completed, would it be possible to place my own solution at the top of the view?
I wonder if it might be better to have to complete a certain percentage of existing kata at a specific kyu rating before being allowed to progress upwards. As I understand the system currently, it takes 10 kata of equal rank to your own to progress, which makes it trivial to advance through the first couple of ranks due to sheer variety and difficulty variances in existing kata at lower ranks.
What purpose would that serve, though?
This comment is hidden because it contains spoiler information about the solution
I learned something today because of this kata. Simpler than I thought it would be!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Would help to explain that rooks can only move in straight lines horizontally or vertically in the kata description. Otherwise I have no objections.
Loading more items...