Breaking

Wednesday 4 October 2017

Castle Towers

                  Castle Towers


Eragon is a dragon that is visiting the town of Osaka. There are  towers of various heights in the city, and tower has height of . Because the taller towers tower over the shorter ones, Eragon can only blow out the tallest towers.
For example assume there are four towers of heights  and . Then Eragon can blow out  towers as there are two towers of maximum height .
Given the height  for each individual tower, find and print the number of towers that Eragon can successfully blow out.
Input Format
The first line contains a single integer, , denoting the number of towers in the city.
The second line contains  space-separated integers, where each integer  describes the height of tower .
Constraints
Output Format
Print the number of towers Eragon blows out on a new line.
Sample Input 0
4
3 2 1 3
Sample Output 0
2
Explanation 0
image
As the tallest towers is of height 3 and there are two occurences, the answer is 2.

Code:

keep on checking this blog!

Please do comment If u have any Queries!

No comments:

Post a Comment

Like