is grossly inefficent. (It first creates a string out of the int, then concatenates it with the existing string, creating yet another string. I'd guess about 90% of the execution time is this routine would be on just that line.
It's not redundant, just bad form. input[i] is a char, " " is a string. The line should be "if (input[i] == ' ')" or better "if (Char.IsWhiteSpace(input[i]))"
Nice to preallocate the StringBuilder, but why are you dragging floating point into the calculation? The result has to be an integer, so you might as well, do everything in integer math.
The problem here is that the line
strReturn = bitCurrent + strReturn;
is grossly inefficent. (It first creates a string out of the int, then concatenates it with the existing string, creating yet another string. I'd guess about 90% of the execution time is this routine would be on just that line.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
strings are an IEnumerable. The ToCharArray() is unnecessary.
What makes you think the Replace() would leave spaces on the start or end?
It's not redundant, just bad form. input[i] is a char, " " is a string. The line should be "if (input[i] == ' ')" or better "if (Char.IsWhiteSpace(input[i]))"
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Nice to preallocate the StringBuilder, but why are you dragging floating point into the calculation? The result has to be an integer, so you might as well, do everything in integer math.
Loading more items...