Ad
  • Custom User Avatar

    In your code, at each iteration, if a character is found in a str1, a new string is created. It turns out that in the worst case you will get str1.length rows in memory

  • Default User Avatar

    This code leaves punctuation intact except for spaces. If the number of spaces is important, then care should have been taken to create suitable tests.

  • Default User Avatar

    Yep, in the tree that is described even in the example, this solution returns the incorrect value "15" instead of "-51".