Count of positives / sum of negatives
Last updated
Was this helpful?
Last updated
Was this helpful?
if input is not array return empty array
fold(reduce) inputs with initialize value [0, 0]
while fold if current value is positive add '1' in first elements of init value
while fold if current value is negative value add in second elements of init value
pass accumulate value to next fold
return process-2 result
time-complexity (Big-O) is O(n)