Ad
  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    It would put "a2" since it ignores the usual "" divider that is created at the beginning of the string that now also includes a 1. So divider[0] = "1" when it usually is divder[0]=""

  • Default User Avatar

    I know this argument went on two years ago but both of these "top 2" solutions use expensive string operations such as .replace(), .lastIndexOf(), and .indexOf() making them O(n^2). If you use an array to store the number of occurances for the 256 ASCII characters and then loop through the string again checking the array for occurances less than 1, you can get a solution that takes O(2n) = O(n).