Just a remark to always benchmark your code to make this statement. As newer releases of .Net Core also Regex gets faster and faster.
So better stay maintainable and readable and let the performance guys do their work
References:
Resizing input references is bad practice.
This will be not obvious to the caller and will lead to strange bugs. Hopefully it is documented somewhere.
Better create new array.
Just a remark to always benchmark your code to make this statement. As newer releases of .Net Core also Regex gets faster and faster.
So better stay maintainable and readable and let the performance guys do their work
References:
This comment is hidden because it contains spoiler information about the solution
discard "Skip(0)", it's a nop
Resizing input references is bad practice.
This will be not obvious to the caller and will lead to strange bugs. Hopefully it is documented somewhere.
Better create new array.
"phrase" is never changed so it is enough to just iterate over "phrase" instead of allocating extra memory for chars.
This comment is hidden because it contains spoiler information about the solution