Proposal: Extra credit where you are limited by time complexity
nickserv opened this issue · comments
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).
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)).