Coding Test/HackerRank
-
[HackerRank] Diagonal Difference c++Coding Test/HackerRank 2022. 7. 16. 20:58
problem 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 = 1 + 5 + 9. The right to left diagonal = 3 +5 +9. Their absolute difference is |15-17| = 2. sample input 3 11 2 4 4 5 6 10 8 -12 output 15 solution 왼쪽방향 대각선, 오른쪽 방향 대각선의 원소들의 합을 구한뒤 둘의 차를 구하는 문제이다. sample ..
-
[HackerRank] A Very Bing Sum c++Coding Test/HackerRank 2022. 7. 16. 20:32
Problem 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 . sample input 5 1000000001 10..