hackerrank
-
Time ConversionEngineering WIKI/HackerRank 2021. 1. 17. 21:01
Given a time in -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 Return '12:01:00'. Return '00:01:00'. Function Description Complete the timeConversion function in the editor below. It should return a new string representing the input time in 24 ..
-
Birthday Cake CandlesEngineering WIKI/HackerRank 2021. 1. 17. 20:59
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. Example The maximum height candles are units high. There are of them, so return . Function Description Complete the function birthdayCakeCandles in the editor below..
-
Mini-Max SumEngineering WIKI/HackerRank 2021. 1. 17. 20:57
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. Example The minimum sum is and the maximum sum is . The function prints 16 24 Function Description Complete the miniMaxSum function in the editor below. mi..
-
StaircaseEngineering WIKI/HackerRank 2021. 1. 17. 20:55
Staircase detail This is a staircase of size : # ## ### #### Its base and height are both equal to . It is drawn using # symbols and spaces. The last line is not preceded by any spaces. Write a program that prints a staircase of size . Function Description Complete the staircase function in the editor below. staircase has the following parameter(s): int n: an integer Print Print a staircase as d..
-
Plus MinusEngineering WIKI/HackerRank 2021. 1. 17. 20:54
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 places after the decimal. Note: This challenge introduces precision problems. The test cases are scaled to six decimal places, though answers with absolute error of up to are acceptable. Example There are elements, two positive, two n..
-
Diagonal DifferenceEngineering WIKI/HackerRank 2021. 1. 17. 20:52
Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix is shown below: 1 2 3 4 5 6 9 8 9 The left-to-right diagonal = . The right to left diagonal = . Their absolute difference is . Function description Complete the function in the editor below. diagonalDifference takes the following parameter: int arr[n][m]: an array of integer..
-
A Very Big SumEngineering WIKI/HackerRank 2021. 1. 17. 20:50
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 ar[n]: an array of integers . Return long: the sum of all array elem..
-
Compare the TripletsEngineering WIKI/HackerRank 2021. 1. 17. 20:48
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[0], a[1], a[2]), and the rating for Bob's challenge is the triplet b = (b[0], b[1], b[2]). The task is to find their comparison points by comp..