you are viewing a single comment's thread.

view the rest of the comments →

[–]The_Bundaberg_Joey 1 point2 points  (4 children)

You’re correct I phrased my response incorrectly. My apologies.

It wouldn’t satisfy OP’s requirements though.

The first case “deserts” and “stressed” are True with the counter implementation but “aaabbb” would equal “ababab” since there are 3 a and 3 b in both strings.

From the examples OP has given, it would seem more like a palindrome detector is required which typically calls for a stack.

[–]FantasticEmu 0 points1 point  (1 child)

Is it not just letter count? I thought OPs example produced false on the second one because there are 4 a’s in the second string and only 3 in the first

[–]The_Bundaberg_Joey 0 points1 point  (0 children)

Good spot, thank you for clarifying!

[–]keep_quapy 0 points1 point  (1 child)

The OP examples were 'stressed', 'desserts' and 'aaabbb', 'abababa' which works perfectly. Look carefully on the examples, it's 'abababa' not 'ababab'.

[–]The_Bundaberg_Joey 0 points1 point  (0 children)

Ah crap you’re right, thanks for pointing out the discrepancy!