this is truly elegant! but would it work for the input ("abcdefghi",3)? The way I see it, the output would be then "abc def ghi " whereas the correct solution should not contain the last space character. Or am I missing something?
probably because it is clearer for beginners (if mostly beginners voted). HashMaps are a little more advanced for a 7kyu problem. I bet there is an even more sophisticated one-liner with streams which (again) would be too much.
how is this working without sorting the vector first?
oh, I like this one, linear time and O(n) less multiplications/divisions than in my solution
that's a best practice to remember ;)
well mutation was not explicitly prohibited, although you are right, of course, this can produce side effects which would be not so easy to debug
great solution!
can't see it somehow
This comment is hidden because it contains spoiler information about the solution
good one!
this is truly elegant! but would it work for the input ("abcdefghi",3)? The way I see it, the output would be then "abc def ghi " whereas the correct solution should not contain the last space character. Or am I missing something?
probably because it is clearer for beginners (if mostly beginners voted). HashMaps are a little more advanced for a 7kyu problem. I bet there is an even more sophisticated one-liner with streams which (again) would be too much.
thanks, Markus! nice one, as well :) I think I just need more practice with the streams to come to that level
very insightful!
wow
will this work with meta characters like ? / - etc.?
that part with replacing ".0" is very elegant.
Loading more items...