Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5701 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 938 |

@bt8816103042 | 739 |

@SHOAIBVIJAPURE | 428 |

@codeantik | 412 |

@SherlockHolmes3 | 407 |

@neverevergiveup | 348 |

@mahlawatep | 347 |

@shalinibhataniya1097 | 343 |

@murarry3625 | 333 |

@saiujwal13083 | 326 |

@rohitanand | 314 |

Complete Leaderboard |

Being a Programmer you have to learn how to make your output looks better. According to the company, its company programmers have to present its output in a different manner as: If your output is 10.000000 you can save the decimal places and thus your output becomes 10. Now u have the learn the way to output. You are given elements of an array A[N] and you have to divide N by total no. of +ve integers, N by total no. of -ve integers, and N by total no. of zero value integers.

**Example 1:**

**Input : **
N = 10
A[] = {7, 7, 7, 7, 7, 7, -9, -9, -9, 0}
**Output : **
1.66667
3.33333
10
**Explanation :
**Positive count = 6, therefore 10/6 = 1.66667
Negative count = 3, therefore 10/3 = 3.33333
Zero's count = 1, therefore 10/1 = 10

**Your Task: **

You don't need to read input or print anything. Your task is to complete the function **Learning()** which takes the array **A[]**, its size **N**, **pos, neg **and** zero**** **as inputs and stores the answers in the reference variables **pos**,** neg** and **zero** the following:-

N by Total no. of +ve integers

N by Total no. of -ve integers

N by Total no. of zero value integers

**Expected Time Complexity:** O(N)

**Expected Auxiliary Space:** O(1)

**Constraints :**

1 ≤ N ≤ 10^{5}

-10^{5} ≤ A[i] ≤ 10^{5}

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Learning Output

...