Skip to content

Issue #11 & #153 fix - IsAnagram#202

Open
alev-98 wants to merge 2 commits into
aalhour:masterfrom
alev-98:issue11/fix
Open

Issue #11 & #153 fix - IsAnagram#202
alev-98 wants to merge 2 commits into
aalhour:masterfrom
alev-98:issue11/fix

Conversation

@alev-98

@alev-98 alev-98 commented Jul 8, 2026

Copy link
Copy Markdown

Description

Closes: #11 & #153
This PR fixes the IsAnagram method, making it so strings with the same characters, but different amount of them, will no longer be treated as anagrams.

The solution creates a list from the source string while the other string is enumerated to remove each char from the list. If a char could not be removed from the list, false is immediately returned.

The first commit adds a failing test: "aab" and "abb" (#153) which should result in false but doesn't.
The second commit fixes the method and the resulting test is now false and passes.

Checklist

  • An issue was first created before opening this pull request
  • The new code follows the contribution guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
    i believe comments are not necessary in this case
  • I have made corresponding changes to the documentation
    i didn't since the nature of this pr
  • My changes generate no new warnings
  • I have added tests to ensure that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IsAnagram logic needs to be fixed

1 participant