I wrote a very similar solution with much more readable variable names. The biggest differences are that mine uses a slice instead of the first for loop, and reads the length values inside of the main loop rather than assigning a new array for them.
Great solution! But could you also kindly sprinkle some few lines of comments for your short var names (if you don't mind) so people (like me) grasp in shorter time
example like what mx_nd is about (took sometime to figure out)
I'm trying to avoid that temptation, but I've been searching for hours on how to call an anonymous class within an anonymous class and the kata doesn't seem to accept any of the solutions I've tried.
Hand checking the input gives correct answer (at least for the couple of inputs i've checked). Can you please give me one input and expected result pair for testRandom input so I can test it on my local machine to test?
No help here?
@AWTom Great, the solution has readability and efficacy.
I wrote a very similar solution with much more readable variable names. The biggest differences are that mine uses a slice instead of the first for loop, and reads the length values inside of the main loop rather than assigning a new array for them.
https://www.codewars.com/kata/reviews/56a5db17af136c8210000058/groups/635a0ade4e920a000183011d/
really cool!
I had to go as far as your comment to understand the exercise. I completely agree with you both: it would be good to clarify the statement.
Great solution! But could you also kindly sprinkle some few lines of comments for your short var names (if you don't mind) so people (like me) grasp in shorter time
example like what
mx_nd
is about (took sometime to figure out)nice and concise!
Clean as f
This comment is hidden because it contains spoiler information about the solution
I'm trying to avoid that temptation, but I've been searching for hours on how to call an anonymous class within an anonymous class and the kata doesn't seem to accept any of the solutions I've tried.
Not sure if you've figured it out in the meantime, but since this comment thread helped me get the right answer I figured I should return the favor:
Where does wallpaper go?
This comment is hidden because it contains spoiler information about the solution
Note you can only have one mini win per sub array.
input
[27, 27, 26, 48, 41, 44, 32, 35, 31, 42, 45, 37, 48, -53, 34, 40, 45, 21, 38, 33]
output:
array(8) { array(2) { [0]=> int(2) [1]=> int(352) } [1]=> array(2) { [0]=> int(3) [1]=> int(336) } [2]=> array(2) { [0]=> int(5) [1]=> int(165) } [3]=> array(2) { [0]=> int(7) [1]=> int(98) } [4]=> array(2) { [0]=> int(11) [1]=> int(77) } [5]=> array(2) { [0]=> int(13) [1]=> int(26) } [6]=> array(2) { [0]=> int(17) [1]=> int(34) } [7]=> array(2) { [0]=> int(19) [1]=> int(38) } }
Hand checking the input gives correct answer (at least for the couple of inputs i've checked). Can you please give me one input and expected result pair for
testRandom
input so I can test it on my local machine to test?Loading more items...