## Hackerrank – Grading Students – PHP

HackerLand University has the following grading policy: Every student receives a grade in the inclusive range from 0 to 100 . Any grade less than 40 is a failing grade. am is a professor at the university and likes to round each student’s grade according to these rules: If the difference between the grade and … Read more

## Hacker Rank – Time Conversion – PHP

Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: – 12:00:00AM on a 12-hour clock is 00:00:00 on a 24-hour clock. – 12:00:00PM on a 12-hour clock is 12:00:00 on a 24-hour clock. Example : S: 12:01:00PM return : 12:01:00 S: 12:01:00AM return : 00:01:00 Function Description Complete the timeConversion … Read more

## Hackerrank – Birthday Cake Candles – PHP

You are in charge of the cake for a child’s birthday. You have decided the cake will have one candle for each year of their total age. They will only be able to blow out the tallest of the candles. Count how many candles are tallest. candles[4,4,1,3] Example : The maximum height candles are 4 … Read more

## Hackerrank – Plus Minus in PHP

Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with 6 places after the decimal.

## Hackerrank – Diagonal Difference – PHP

Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix arr is shown below: 1 2 3 4 5 6 9 8 9 The left-to-right diagonal = 1+5+9 =15 . The right to left diagonal = 3+5+9=17 Their absolute difference is |15-17| =2 Function description Complete … Read more

## Hackerrank – A Very Big Sum – PHP

In this challenge, you are required to calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large. Function Description Complete the aVeryBigSum function in the editor below. It must return the sum of all array elements. aVeryBigSum has the following parameter(s): int … Read more

## Hackerrank – Compare the Triplets – PHP

Alice and Bob each created one problem for HackerRank. A reviewer rates the two challenges, awarding points on a scale from 1 to 100 for three categories: problem clarity, originality, and difficulty. The rating for Alice’s challenge is the triplet a = (a, a, a), and the rating for Bob’s challenge is the triplet b … Read more

## Hackerrank – Simple Array Sum In PHP

Given an array of integers, find the sum of its elements.