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

Proposal: Extra credit where you are limited by time complexity #10

Open
nickserv opened this issue Feb 12, 2015 · 1 comment
Open

Proposal: Extra credit where you are limited by time complexity #10

nickserv opened this issue Feb 12, 2015 · 1 comment

Comments

@nickserv
Copy link
Member

Spoiler alert, don't read this if you haven't completed the activity!

Many of the solutions for this activity (including my own) use sort in the canonical method, which works well but does not have an optimal time complexity. I think it would be fun if there was an extra credit part of this where you would need to at least be as good as O(n).

@deanmax
Copy link

deanmax commented Feb 12, 2015

Save each char of both strings into two hashes and compare the two hashes. Assuming all chars are ascii so that space is only 256 (O(1)).

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

No branches or pull requests

2 participants