We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
At line 36, you're using multiReplace twice:
multiReplace
let data = input.multiReplace(($x, "")).multiReplace(($(char(ord(x)-32)), ""))
You can simplify (and probably slightly improve speed) it by using just one of them:
let data = input.multiReplace(($x, ""), ($(char(ord(x)-32)), ""))
But, since you already return a string from solve1, much bigger speed improvement can be achieved by re-using that shortened string:
solve1
let shortened = solve1(input) echo shortened.len echo solve2(shortened)
(After that, if you want even faster solution, I wouldn't directly modify data by using delete in solve1 — that's quite expensive)
data
delete
The text was updated successfully, but these errors were encountered:
@narimiran Thanks for the comment! I am in the process of learning Nim and suggestions like this is welcome.
Sorry, something went wrong.
No branches or pull requests
At line 36, you're using
multiReplace
twice:You can simplify (and probably slightly improve speed) it by using just one of them:
But, since you already return a string from
solve1
, much bigger speed improvement can be achieved by re-using that shortened string:(After that, if you want even faster solution, I wouldn't directly modify
data
by usingdelete
insolve1
— that's quite expensive)The text was updated successfully, but these errors were encountered: