본문 바로가기

hackerrank10

Time Conversion 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 .. 2021. 1. 17.
Birthday Cake Candles 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.. 2021. 1. 17.
Mini-Max Sum 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.. 2021. 1. 17.
Staircase 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.. 2021. 1. 17.
Plus Minus 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.. 2021. 1. 17.
Diagonal Difference 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.. 2021. 1. 17.