은더기 2024. 1. 28. 14:17

문제

내 정답 코드

import Foundation

func solution(_ number:Int, _ n:Int, _ m:Int) -> Int {
    return number.isMultiple(of: n) && number.isMultiple(of: m) ? 1 : 0
}

 

#

1. isMultiple과 삼항연산자를 통해 공배수를 판단하였다.

 


배운 기술