Question: pls write the codes as simple as possible. Thank you. java Colleen is turning n years old! She has n candles of various heights on

pls write the codes as simple as possible.

Thank you.

pls write the codes as simple as possible. Thank you. java Colleen

java

Colleen is turning n years old! She has n candles of various heights on her cake, and candle i has height height_i. Because the taller candles tower over the shorter ones, Colleen can only blow out the tallest candles. Given the height_i for each individual candle, find and print the number of candles she can successfully blow out. Input Format The first line contains a single integer, n, denoting the number of candles on the cake. The second line contains n space-separated integers, where each integer i describes the height of candle i. Output Format Print the number of candles Colleen blows out on a new line. Sample Input 4 3 2 1 3 Sample Output 2 Explanation We have one candle of height 1, one candle of height 2, and two candles of height 3. Colleen only blows out the tallest candles, meaning the candles where height = 3. Because there are 2 such candles, we print 2 on a new line

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!