Beta
Block-exchanging reverse
Loading description...
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Why is this not done for arrays with variable lengths? First, odd and even arrays have different characteristics; second, only requiring to solve for 1 length instead of all arrays in general makes the problem very boring, and becomes a puzzle rather than a kata.
The tests are unnecessarily obtuse: it doesn't even show what the actual array length or the exchange end result is when the tests fails, which is unacceptable.
To find the solution to this problem, one could try to find it via programming, or maybe find the solution from some sources, but even when programming is used, that code is not the code that will find its way in the solution box.
In essence you are asking for an object literal, and only because that would be a long literal (50 entries) one could decide to shorten the solution text with the use of some kind of loop. But that code is not essential to the kata, and so we cannot really call this a code challenge.
For that reason I do not find this very useful. Solutions don't reveal how the solution was found (if by programming at all).
It would be a bit better (but not much) if this kata asked for the shortest exchange array (without revealing any clues about how short that would be) for any array sizes. That would at least require some programming code to appear in the solution, and you could make your tests dynamic as well (i.e. with random tests).
Yes, this is not "code challenge". Solving this problem is only an idea (in the form of a set of 3*m integers), and it does not matter how it will be framed. The length of the array also has no special meaning. 99 is enough to find the common idea for any odd length, not to use brute force.