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
|
3150 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch the explanation here : https://youtu.be/OqevjJbsN2Q
C# : public static void plusMinus(List arr) { decimal positive =0; decimal negative = 0; decimal zero =0 ; int total= arr.Count;
Console.WriteLine(positive /total); Console.WriteLine(negative /total); Console.WriteLine(zero / total);
Console.WriteLine(positive /total); Console.WriteLine(negative /total); Console.WriteLine(zero / total);
l = len(s) c1 = 0 c2 = 0 c3 = 0
for i in s: if i>0: c1 += 1 if i<0: c2 += 1 elif i == 0: c3 += 1 listc = [] listc.append(c1) listc.append(c2) listc.append(c3) for i in listc: result = i/l print(f'{result}00000')
def plusMinus(arr): # Write your code here p=n=z=0
if name == 'main': n = int(input().strip())
arr = list(map(int, input().rstrip().split()))
plusMinus(arr)
GO
}