분류 전체보기
-
import Foundation func solution(_ price:Int) -> Int { let price = Double(price) switch price { case 100000..
[Swift] 옷가게 할인 받기import Foundation func solution(_ price:Int) -> Int { let price = Double(price) switch price { case 100000..
2023.01.05 -
import Foundation func solution(_ numbers:String) -> Int64 { let alphabet = ["zero":0, "one":1, "two":2, "three":3, "four":4, "five":5, "six":6, "seven":7, "eight":8, "nine":9] var result = "" var number = "" for n in numbers { number += String(n) if alphabet.keys.contains(number) { result += String(alphabet[number]!) number = "" } } return Int64(result)! }
[Swift] 영어가 싫어요import Foundation func solution(_ numbers:String) -> Int64 { let alphabet = ["zero":0, "one":1, "two":2, "three":3, "four":4, "five":5, "six":6, "seven":7, "eight":8, "nine":9] var result = "" var number = "" for n in numbers { number += String(n) if alphabet.keys.contains(number) { result += String(alphabet[number]!) number = "" } } return Int64(result)! }
2022.12.26 -
import Foundation func solution(_ num:Int, _ total:Int) -> [Int] { let startNum = total/num - num/2 + (num % 2 == 0 ? 1 : 0) return (0..
[Swift] 연속된 수의 합import Foundation func solution(_ num:Int, _ total:Int) -> [Int] { let startNum = total/num - num/2 + (num % 2 == 0 ? 1 : 0) return (0..
2022.12.26 -
import Foundation func solution(_ n:Int, _ k:Int) -> Int { let sheep = 12000 let drink = 2000 let k = k - n / 10 return n * sheep + k * drink }
[Swift] 양꼬치import Foundation func solution(_ n:Int, _ k:Int) -> Int { let sheep = 12000 let drink = 2000 let k = k - n / 10 return n * sheep + k * drink }
2022.12.26 -
import Foundation func solution(_ n:Int) -> [Int] { return (1...n).filter{ n % $0 == 0} }
[Swift] 약수 구하기import Foundation func solution(_ n:Int) -> [Int] { return (1...n).filter{ n % $0 == 0} }
2022.12.26 -
import Foundation func solution(_ cipher:String, _ code:Int) -> String { cipher.enumerated().filter { ($0.offset + 1) % code == 0 }.map { String($0.element) }.joined() }
[Swift] 암호해독import Foundation func solution(_ cipher:String, _ code:Int) -> String { cipher.enumerated().filter { ($0.offset + 1) % code == 0 }.map { String($0.element) }.joined() }
2022.12.26 -
import Foundation func solution(_ board:[[Int]]) -> Int { var results: [[Int]] = Array(repeating: Array(repeating: 0, count: board.count), count: board.count) for (i,first) in board.enumerated() { for (j,second) in first.enumerated() { if board[i][j] == 1 { for x in i-1...i+1 { for y in j-1...j+1{ if 0
[Swift] 안전지대import Foundation func solution(_ board:[[Int]]) -> Int { var results: [[Int]] = Array(repeating: Array(repeating: 0, count: board.count), count: board.count) for (i,first) in board.enumerated() { for (j,second) in first.enumerated() { if board[i][j] == 1 { for x in i-1...i+1 { for y in j-1...j+1{ if 0
2022.12.26 -
import Foundation func solution(_ money:Int) -> [Int] { return [money / 5500, money % 5500] }
[Swift] 아이스 아메리카노import Foundation func solution(_ money:Int) -> [Int] { return [money / 5500, money % 5500] }
2022.12.26