C
C#8mo ago
AyaMaya

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
Angius8mo 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
AyaMaya
AyaMayaOP8mo 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
Angius8mo 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