Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issue #11 #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fixed issue #11 #149

wants to merge 2 commits into from

Conversation

itai192
Copy link

@itai192 itai192 commented Sep 25, 2020

this is my first commit to a public repo, so I don't know if I'm doing it right

Description

fixed issue #11

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 have made corresponding changes to the documentation
  • 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

this is my first commit to a public repo, so i don't know if i'm doing it right
Copy link

@dmitryvhf dmitryvhf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decline.

  1. The current correct code has been broken.
  2. StringPermutationTests discredited.

int index = other.IndexOf(source[i]);
if(index==-1)
return false;
other.Remove(index);
Copy link

@dmitryvhf dmitryvhf Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutly critical code!

  1. Remove(index) - remove From to End. You are drop all symbols from right.
  2. String immunable. "other" object it not changed.
    Example: other = other.Remove(index, 1);
    But this bad too - immunable string operation = bad performance, memory and etc. problem.

StringPermutationTests discredited. This test case must will be fail.

var one = "dbcdefg"; var two = "dabcgfe"; Assert.True(Permutations.IsAnargram(one, two) == true);

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.

None yet

2 participants