Ad
  • Default User Avatar
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    the 'g' flag means global
    'g' flag -> apply to all chars in the input string until reaching the end || [regexp definition] do not return after the first match
    so without the 'g' flag it will stop at the first set of matches of a single char
    with the 'g' flag it will continue past the first set and apply the rule to remaining sets giving the correct count

  • Custom User Avatar

    You can print the input and try to count the duplicate by hand to see for yourself ;-)

  • Default User Avatar

    Passed all suites except last one. Are you sure expected value should be 2 not 1? (It concerns attempt cases not sample test)