Ad
  • Default User Avatar

    "Same goes for all the other arrays/lists that you will get in the tests.."

  • 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

  • Custom User Avatar

    Sure, and if my palindrome checking function ever becomes a time-critical component of the next NASA mission then I might want to consider re-writing it for better performance.

    But until then I prefer to code with emphasis on readability.

  • 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