import Foundation

func solution(_ data:[[Int]], _ col:Int, _ row_begin:Int, _ row_end:Int) -> Int {
    var result = 0
    var data = data
        .sorted { $0[0] > $1[0] }
        .sorted { $0[col-1] < $1[col-1] }
    
    for i in row_begin...row_end {
        result ^= data[i-1].reduce(0, { $0 + ($1 % i) })
    }
    
    return result
}

 

'프로그래머스 > Lv.2' 카테고리의 다른 글

[Swift] 과제 진행하기  (0) 2024.01.07
[Swift] 혼자 놀기의 달인  (0) 2023.06.24
[Swift] 미로 탈출  (0) 2023.06.24
[Swift] 문자열 압축  (0) 2023.06.23
[Swift] 시소 짝궁  (0) 2023.06.23

+ Recent posts