আগামী ২৩ অক্টোবর -২০১৭ তারিখ থেকে শুরু হচ্ছে পাঁচ মাস ব্যাপী Professional Web Design and Development with HTML,CSS,Bootstrap,PHP,MySQl, AJAX and JQUERY কোর্সের ৮৬ তম ব্যাচ। আগ্রহীদেরকে অতিসত্বর মাসুদ আলম স্যার এর সাথে যোগাযোগ করতে অনুরোধ করা যাচ্ছে। স্যার এর মোবাইল: 01722817591, Email : [email protected] কোর্সের সিলেবাস এর জন্য এখানে ক্লিক করুন ।

Birthday Cake Candles, Algorithm

Colleen is turning years old! She has candles of various heights on her cake, and candle has height . Because the taller candles tower over the shorter ones, Colleen can only blow out the tallest candles.

Given the 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, , denoting the number of candles on the cake.
The second line contains space-separated integers, where each integer describes the height of candle .

Constraints

Output Format

Print the number of candles Colleen blows out on a new line.

Sample Input 0

4
3 2 1 3

Sample Output 0

2

Explanation 0

We have one candle of height , one candle of height , and two candles of height . Colleen only blows out the tallest candles, meaning the candles where . Because there are such candles, we print on a new line.

 

 

 

<?php

$handle = fopen ("php://stdin","r");
fscanf($handle,"%d",$n);
$height_temp = fgets($handle);
$height = explode(" ",$height_temp);
array_walk($height,'intval');

$m=max($height);
$a=array_count_values($height);
echo $a[$m];

?>

 

 

I am PHP problem solver at Hackerrank. I am preparing myself for PHP zend certification exam with Masud Alam sir. I have completed few websites using LARAVEL, also have experience on WORDPRESS.

Leave a Reply

Your email address will not be published. Required fields are marked *