You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Foundation
func solution(_ n:Int)->Int{varresult=0if n ==0{return0}foriin1...Int(sqrt(Double(n))){if n % i ==0{if i != n / i {
result +=(n / i)}
result += i
}}return result
}
💬 더 나은 방법?
func solution(_ n:Int)->Int{guard n !=0else{return0}returnArray(1...n).filter{ n % $0 ==0}.reduce(0,+)}
💬 알게된 것
제곱근을 주의할것!!
The text was updated successfully, but these errors were encountered:
💬 문제
[코딩테스트 연습 - 약수의 합](https://school.programmers.co.kr/learn/courses/30/lessons/12928)
💬 풀이
💬 더 나은 방법?
💬 알게된 것
The text was updated successfully, but these errors were encountered: