Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
If you click "show solution" under a comment with the kata set to a specific lang then it will show the users last submitted attempt (or passed attempt) for that lang.
Also, even if you do manage to solve your data integrity issues, you'll probably still timeout, as you're using an inferior algorithm. Parallelism isn't going to help you here.
I didn't decide that you're using parallelism; you're using
Parallel.For
, which literally hasParallel
in its name, and is a parallism construct.If you don't even know what you're using before using it and ended up shooting yourself in the foot, I'd suggest actually looking it up first?
Also, for the record, I can see your solution code; there are exactly 2 spots where concurrency issue exists.
Anyways, the problem you're having is, you're using parallelism, but you never made any attempt to make your code thread-safe, so the values become messed up once input size gets big.
This is not really a issue, this is a question.