in reply to Re: Check if string A and B are made up of same chars
in thread Check if string A and B are made up of same chars

Well the OP said "made up of same chars" but he wants "same amount of same characters" ¹

Please compare how his test for "ABB" and "ABA" are supposed to fail.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

¹) or in math lingo "is a permutation"

  • Comment on Re^2: Check if string A and B are made up of same chars

Replies are listed 'Best First'.
Re^3: Check if string A and B are made up of same chars
by karlgoethebier (Abbot) on Nov 17, 2024 at 17:54 UTC
      > And aren't you neglecting the length in your example?

      Nope, different length will fail. (See also second test)

      But yes, I was only concentrating on the essential part, his "specs" are indeed a bit fuzzy.

      Anyway, there's no point in optimizing for speed if the problem-space is under-defined

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery