목록해커랭크 (3)
동도리 개발 로그
문제 ====== https://www.hackerrank.com/challenges/diagonal-difference/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 = . The right to left diagonal = . Their absolute difference is . Function description Complete the function in the editor below. It must ..
package main import ( "fmt" ) //올림 차순 func selectionSortmintomax(array []int) { for i := 0; i < len(array)-1; i++ { min := i for j := i + 1; j < len(array); j++ { if array[j] < array[min] { min = j } } array[i], array[min] = array[min], array[i] } } //내림 차순 func selectionSortmaxtomin(array []int) { for i := 0; i < len(array)-1; i++ { max := i for j := i + 1; j < len(array); j++ { if array[j] < a..
문제 링크 -https://www.hackerrank.com/challenges/crush/problem Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in your array. For example, the length of your array of zeros . Your list of queries is as follows: a b k 1 ..