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.
- Prepare
- Algorithms
- Warmup
- Plus Minus
- Discussions
Plus Minus
Plus Minus
Sort by
recency
|
3213 Discussions
|
Please Login in order to post a comment
Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-plus-minus-problem-solution.html
}
TypeScript
TypeScript
def isNegative(x): return x < 0
def isPositive(x): return x > 0
def isZero(x): return x == 0
def plusMinus(arr): # Write your code here negative = float(len(list(filter(isNegative, arr))) / len(arr)) positive = float(len(list(filter(isPositive, arr))) / len(arr)) zero = float(len(list(filter(isZero, arr))) / len(arr))