We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Plus Minus
- Discussions
Plus Minus
Plus Minus
Sort by
recency
|
663 Discussions
|
Please Login in order to post a comment
in c# public static void plusMinus(List arr) {
enumerate is slightly faster than for
def plusMinus(arr): positives = 0 zeros = 0 negatives = 0 size = len(arr)
if name == 'main': n = int(input().strip())
#
}
const { positives, negatives, zeros } = arr.reduce((acc, x) => { if (x > 0) acc.positives += 1; else if (x < 0) acc.negatives += 1; else acc.zeros += 1; return acc; }, { positives: 0, negatives: 0, zeros: 0 });
Java streams