Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Agree with you, I'll fix it :)

  • Custom User Avatar

    Think that in each iteration of this for loop you are executing a count, which means that a.count(i) is iterating over the entier string a and adding up the amount of times it sees character i. This presents no issues when the words are quite small, but since the "time complexity of the count(value) method is O(n) for a list with n elements", when larger words are encoded for duplicates with this algorithm, it will take O(n²) because within each iteration of the for loop, you will iterate over the entire word again just to count the numner of times the character appears.