분류 전체보기
-
import Foundation func solution(_ my_string:String) -> Int { return my_string.compactMap { Int(String($0)) }.reduce(0, +) }
[Swift] 숨어있는 숫자의 덧셈 (1)import Foundation func solution(_ my_string:String) -> Int { return my_string.compactMap { Int(String($0)) }.reduce(0, +) }
2023.02.10 -
import Foundation func solution(_ before:String, _ after:String) -> Int { before.sorted() == after.sorted() ? 1 : 0 }
[Swift] A로 B 만들기import Foundation func solution(_ before:String, _ after:String) -> Int { before.sorted() == after.sorted() ? 1 : 0 }
2023.02.08 -
import Foundation func solution(_ n:Int) -> Int { (1...n).filter { n in (1...n).filter {n % $0 == 0}.count > 2 }.count }
[Swift] 합성수 찾기import Foundation func solution(_ n:Int) -> Int { (1...n).filter { n in (1...n).filter {n % $0 == 0}.count > 2 }.count }
2023.02.08 -
import Foundation func solution(_ s: String) -> String { return Dictionary(grouping: Array(s).map(String.init), by: { $0 }).filter { $0.value.count
[Swift] 한번만 등장한 문자import Foundation func solution(_ s: String) -> String { return Dictionary(grouping: Array(s).map(String.init), by: { $0 }).filter { $0.value.count
2023.02.08 -
import Foundation func solution(_ slice:Int, _ n:Int) -> Int { return (n - 1) / slice + 1 }
[Swift] 피자 나눠 먹기 (3)import Foundation func solution(_ slice:Int, _ n:Int) -> Int { return (n - 1) / slice + 1 }
2023.02.08 -
import Foundation func solution(_ n:Int) -> Int { var result = 1 while true { if (6 * result) % n == 0 { return result } result += 1 } }
[Swift] 피자 나눠 먹기 (2)import Foundation func solution(_ n:Int) -> Int { var result = 1 while true { if (6 * result) % n == 0 { return result } result += 1 } }
2023.02.08 -
import Foundation func solution(_ n:Int) -> Int { return (n - 1) / 7 + 1 }
[Swift] 피자 나눠 먹기 (1)import Foundation func solution(_ n:Int) -> Int { return (n - 1) / 7 + 1 }
2023.02.08 -
import Foundation func solution(_ dots:[[Int]]) -> Int { if Double(dots[0][1] - dots[1][1]) / Double(dots[0][0] - dots[1][0]) == Double(dots[2][1] - dots[3][1]) / Double(dots[2][0] - dots[3][0]) { return 1 } if Double(dots[0][1] - dots[2][1]) / Double(dots[0][0] - dots[2][0]) == Double(dots[1][1] - dots[3][1]) / Double(dots[1][0] - dots[3][0]) { return 1 } if Double(dots[0][1] - dots[3][1]) / Do..
[Swift] 평행import Foundation func solution(_ dots:[[Int]]) -> Int { if Double(dots[0][1] - dots[1][1]) / Double(dots[0][0] - dots[1][0]) == Double(dots[2][1] - dots[3][1]) / Double(dots[2][0] - dots[3][0]) { return 1 } if Double(dots[0][1] - dots[2][1]) / Double(dots[0][0] - dots[2][0]) == Double(dots[1][1] - dots[3][1]) / Double(dots[1][0] - dots[3][0]) { return 1 } if Double(dots[0][1] - dots[3][1]) / Do..
2023.02.08