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.
3 Replies
What you have here should be fine
Not sure what that
IndexOf
is doing there
But what you have should be performant and perfectly fineI 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
Seeing how && short-circuits, no, I don't think it's much of an improvement