본문 바로가기

전체 글621

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.
A Very Big Sum 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.. 2021. 1. 17.
Compare the Triplets 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.. 2021. 1. 17.
Simple Array Sum Given an array of integers, find the sum of its elements. For example, if the array , , so return . Function Description Complete the simpleArraySum function in the editor below. It must return the sum of the array elements as an integer. simpleArraySum has the following parameter(s): ar: an array of integers Input Format The first line contains an integer, , denoting the size of the array. The .. 2021. 1. 17.
Solve Me First Complete the function solveMeFirst to compute the sum of two integers. Example Return . Function Description Complete the solveMeFirst function in the editor below. solveMeFirst has the following parameters: int a: the first value int b: the second value Returns - int: the sum of and Constraints Sample Input a = 2 b = 3 Sample Output 5 Explanation 2+3 = 5 def solveMeFirst(a,b): # Hint: Type retu.. 2021. 1. 17.