Ad
  • Default User Avatar

    If the tests required you to output the full sequential set, then yes, Map is the answer. However, it is overkill here because the kata is greedy, and only asks for a single output variable. So it's enough to simply not update the output variable unless you find a longer sequence.

    I haven't really delved too deeply into it, but Map will store the characters in strict order of appearance, while the tests seem to be looking for the order of sequence appearance, which takes more code than is necessary for a greedy algorithm.