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
|
608 Discussions
|
Please Login in order to post a comment
Java Code
}
let num = arr.length;
const positive: number[] = arr.filter(num => num > 0); const negative: number[] = arr.filter(num => num < 0); const zero: number[] = arr.filter(num => num == 0);
}
Here is the solution in JavaScript.
function plusMinus(arr) { let pos = 0, neg = 0, zero = 0; const len = arr.length || 0;
}
Here is the solution in python3
!/bin/python3
import math import os import random import re import sys
#
Complete the 'plusMinus' function below.
#
The function accepts INTEGER_ARRAY arr as parameter.
#
def plusMinus(arr): # Initialize counters for positive, negative, and zero elements positive_count = 0 negative_count = 0 zero_count = 0
if name == 'main': n = int(input().strip())