Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

b. What are its goals and objectives?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago