You are viewing a single comment's thread. Return to all comments →
I was having problems with testcase #5. Then I realized that I was using Console.WriteLine inside the loop, and this is VERY slow, specially for 1M entries.
So, I used a StringBuilder and printed everything in the end. I went from more than 3s to 0.89s. The problem is not always with your algorithm, but it may be with the way your are printing.