195. 부족한 금액 계산하기
import Foundation func solution(_ price:Int, _ money:Int, _ count:Int) -> Int64{ var answer:Int64 = -1 var Price : Int = 0 Price = (1...count).map{$0}.reduce(0, +) * p...
import Foundation func solution(_ price:Int, _ money:Int, _ count:Int) -> Int64{ var answer:Int64 = -1 var Price : Int = 0 Price = (1...count).map{$0}.reduce(0, +) * p...
func solution(_ s:String) -> String { var string : String = "" string = s.map{String($0)}.sorted(by:>).joined() return string } 배열로 변환하여 내림차순으로 한뒤 다시 join으로 하면서 ...
import Foundation func solution(_ left:Int, _ right:Int) -> Int { var n : Int = 0 var num : Int = 0 var answer : Int = 0 for i in left ... right { n = 1 ...
import Foundation func solution(_ a:[Int], _ b:[Int]) -> Int { var answer : Int = 0 for i in a.indices{ answer += a[i]*b[i] } return answer } for문을 사용해서 해결했는...
func solution(_ n:Int) -> String { var answer : String = "" var sent : String = "" sent = String(repeating: "수박", count:5000) answer = String(sent.prefix(n)) ...
func solution(_ s:String) -> String { var answer : String = "" var S : String = "" var n : Int = 0 S = s n = S.count answer = n % 2 == 0 ? String(S[String.Index(enc...
func solution(_ arr:[Int]) -> [Int] { var answer : [Int] = [] answer = arr if answer.count > 1 { answer.remove(at:answer.firstIndex(of:arr.min(...
import Foundation func solution(_ numbers:[Int]) -> Int { var answer : Int = 0 answer = (0...9).map{$0}.reduce(0, +) - numbers.reduce(0,+) return answer } 없는 숫...
func solution(_ phone_number:String) -> String { var answer : String = "" var arr : [String] = [] arr = phone_number.map{String($0)} if arr.count > 4 { ...
나의 코드 import Foundation func solution(_ absolutes:[Int], _ signs:[Bool]) -> Int { var answer : Int = 0 for (index, value) in signs.enumerated() { if value == true { ...