08-09-2013 03:11 PM
Hi, Could you please let me know what is the EQUIVALENT for this code. This code replace 2 number of 0s or 1s to Just one 0 or 1. The code is very very slow when the input string is very big. Is there any way to replace it with something faster.
Thanks
08-09-2013 04:41 PM
Can you provide some numbers? How many characters are in a "very big" string? How long does it take to be "very very slow" code?
How many replacements typically occur in your string?
Do your strings ever have anything which is not a 1 or zero?
Lynn
08-09-2013 04:55 PM
This code takes 1ms to run on a string of 60,000 characters (one continuous string of 0's and 1's). Whereas using your code, it takes about 900ms for the same string.