Ad
  • Default User Avatar

    This is not true with every object. More - an alphabet may contain more or less symbols than latin alphabet. There is no hints in the task that it is latin alphabet. That is why solution O(1) does not exist. Best complexity is O(n) where n is the size of the alphabet. I belive that you need О(n) memory for that complexity. This solution complexity is О(n^2).

  • Default User Avatar

    I believe that no one can do it with O(1). The best possible solution O(n) where n is all possible symbols in an alphabet.

  • Default User Avatar

    Kata needs more precise description.

  • Default User Avatar

    Kata needs test cases.