It's a very strange proposition for a kata. I, too, came to search the comments for an explanation!
I almost didn't want to to do it because it felt so artificial, like something I would never actually want to do. Lots of people rated this highly, however, and I DO want to do it, just... not sure which language to choose at the moment.
Hi, I have a suggestion here. Since the function prototype is vector<int> sortTwisted37 (vector<int> numbers);, this warning is redundant in the kata description,
You should not modify the input array!
vector<int> numbers is passed by value, so there is no way to modify it.
It's not broken, you just aren't accounting for padding.
The random tests are encoding it, then decoding. However due to the way it encodes, strings who's length is not divisible by 4 will have padding added in encoding.
If you look at the example I try to show what I mean. Say you have an image:
A B C
F G H
K L M
N O P
G and L are the only pixels with 8 neighbors present but each pixel still needs 8 for the filter to work. A only has 3, so the other 5 have to come from somewhere else; for this algorithm you should use the edges/corners own values. So with A the other neighbors in relation to the whole image (besides B, F, and G) will look like:
if price is zero then the result will be -1
closing
It's a very strange proposition for a kata. I, too, came to search the comments for an explanation!
I almost didn't want to to do it because it felt so artificial, like something I would never actually want to do. Lots of people rated this highly, however, and I DO want to do it, just... not sure which language to choose at the moment.
The solutions with
all
works in a similar mannerI like the images given in this kata. But it really shoudn't be a 6kyu kata. It's way too easy.
Expected and actual params in the fixed tests were flipped. Fixed.
Hi, I have a suggestion here. Since the function prototype is
vector<int> sortTwisted37 (vector<int> numbers);
, this warning is redundant in the kata description,vector<int> numbers
is passed by value, so there is no way to modify it.It's not memory efficient and involves lots of string concatenation. I don't recommend this.
It's not broken, you just aren't accounting for padding.
The random tests are encoding it, then decoding. However due to the way it encodes, strings who's length is not divisible by 4 will have padding added in encoding.
This comment is hidden because it contains spoiler information about the solution
If you look at the example I try to show what I mean. Say you have an image:
G
andL
are the only pixels with 8 neighbors present but each pixel still needs 8 for the filter to work.A
only has 3, so the other 5 have to come from somewhere else; for this algorithm you should use the edges/corners own values. So withA
the other neighbors in relation to the whole image (besidesB
,F
, andG
) will look like:Can someone fix this kata? Random test has been broken for so long. Why don't the author use standard base64 module as backend to test?
I think this is better than highly upvoted solution. It doesn't have to loop through all the items if one item fails.
Well, stack can be implemented with linked list, just saying.
Ultimate question! Well done!
Loading more items...