Ad
  • Default User Avatar

    Exactly what I did! I originally started making it "fancy" like the most liked solution but totally agree that this is more readable and you don't even have to think about what's happening. It's just as efficient as well.

  • Default User Avatar

    I originally went down a path of testing each letter against each other letter in the array and immediately my head hurt. Then I thought, why not compare each letter against a transformed array in which the letter is taken out, and I remembered I can filter to achieve that. I counted the length of the transformed array which is equal to the number of letters 'l' removed. If more than 1 'l' is removed then obviously it's a duplicate and the parens character for that letter should be changed.

  • Default User Avatar

    I cleaned this up but can't remove this solution. Saved an extra step in the cleaned up version.