๋ฐ์ํ
import Foundation
func solution(_ A: [Int], _ B: [Int]) -> Int
{
var ans = 0
let a = A.sorted(by: <)
let b = B.sorted(by: >)
for i in 0..<a.count {
ans += a[i] * b[i]
}
return ans
}
๋ฐ์ํ
'๐ ์ฝํ > ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Swift] ํ๋ก๊ทธ๋๋จธ์ค92342 ์๊ถ๋ํ (0) | 2023.05.11 |
---|---|
[Swift] ํ๋ก๊ทธ๋๋จธ์ค118667 ๋ ํ ํฉ ๊ฐ๊ฒ ๋ง๋ค๊ธฐ (0) | 2023.05.11 |
[Swift] ํ๋ก๊ทธ๋๋จธ์ค150369 ํ๋ฐฐ๋ฐฐ๋ฌ๊ณผ ์๊ฑฐํ๊ธฐ (0) | 2023.05.10 |
[Swift] ํ๋ก๊ทธ๋๋จธ์ค150368 ์ด๋ชจํฐ์ฝ ํ ์ธํ์ฌ (0) | 2023.05.09 |
[Swift] ํ๋ก๊ทธ๋๋จธ์ค 12951 JadenCase ๋ฌธ์์ด ๋ง๋ค๊ธฐ (0) | 2023.05.05 |