C
C#7mo ago
・maya・

Decrease all of arrays by 1, optimization because of Time limit Exeeded

Hi I want a code to reduce all ints in int[] happiness, exept for zeros to stay. I was wondering if it was possible to see if all Items left in the array are zero or if all items left in the array are not greater than zero if that makes sense.
No description
3 Replies
Angius
Angius7mo ago
What you have here should be fine Not sure what that IndexOf is doing there But what you have should be performant and perfectly fine
・maya・
・maya・OP7mo ago
I understand the code works, the && is used to optimise a little bit? idk man i redid the code i thought that entire part is useless
Angius
Angius7mo ago
Seeing how && short-circuits, no, I don't think it's much of an improvement
Want results from more Discord servers?
Add your server