I like it!
Why using phrases.length since it's always equal 6 ?
However great way of solving the %6=0 problem.
Based on the tags, I'd assume the author intended a regex solution but I would always endorse built-in functions when they're more succinct and readable. :)
make is no longer accessible in solutions.
This exposes a weakness in the tests. The logic is actually incorrect as other commenters have noted.
ok, checked it by myself. good solution.
what about litres <2 (int 1)? is it works?
@CBBBrother I think his method is pretty safe, considering he's not copying the vector for each stack frame but instead only the reference to that vector.
@yidui From what I understand, the function isn't tail recursive because the recursive call isn't the last operation performed by the function (last operation being the allocation of the new object). I don't really see how one could write it as a tail recursive funcion really...
This should be upvoted as best practice. Yes, not a one-liner, but the array length is not hardcoded, either.
Well, I´m feeling stupid right now. Never knew toLocaleString() existed. I feel like is cheating due to how easily solves the kata. Anyway, I just learned a new thing.
That would work. However, it is a solution inefficient in terms of memory, as you are creating another list having the same size of the original.
There are better ways, as seen in other people's solutions.
This comment is hidden because it contains spoiler information about the solution
Cool! I didn't know you could do that with sort.