목록해커랭크/알고리즘 (2)
동도리 개발 로그
문제 ====== 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..