새소식

인기 검색어

프로그래머스/Lv.2

[Swift] 테이블 해시 함수

  • -
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 }

 

Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.