Ad
  • Default User Avatar

    finally somebody, who cares about clean, reader-friendly code :)

  • Default User Avatar

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

  • Default User Avatar

    although checking equalsIgnoreCase on reversed string is somehow clever,
    we make a copy of the array, and then we reverse it, and on the top of that, if string is a palindrome,
    algorightm would make double check on every character.
    This could be avoidied by making iteration using str.chatAt(i) .. well .. but it wouldnt be so clean

  • Default User Avatar

    But this solution, doest not handle case, when we find unchanged meerkats
    "Something has gone terribly wrong - someone has gone and switched their heads and tails around!"
    It does not say that "switched ALL their heads and tails around" ..

    The only challange in this task is to understand business logic ...

  • Default User Avatar

    But this solution, doest not handle case, when we find unchanged meerkats
    "Something has gone terribly wrong - someone has gone and switched their heads and tails around!"
    It does not say that "switched ALL their heads and tails around" ..

    The only challange in this task is to understand business logic ...

  • Default User Avatar

    string.toCharArray() underneath makes a copy of the String character array (defensive programming)
    If we prepare array by making new char[string.lenth()] and then iterate trought string using chatAt(i) we could avoid one array copy