์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- ๋ถํ ์ ๋ณต
- ์ฝํ
- SwiftUI
- ๊ทธ๋ฆฌ๋ ์๊ณ ๋ฆฌ์ฆ
- WebApp
- ์ด์งํ์
- ์คํ
- ๋ถํ ํ์
- ๋ฌธ์์ด
- ์์
- ๋์ ํฉ
- ์ฝ๋ฉํ ์คํธ
- BFS
- Swift
- ํ๋ก๊ทธ๋๋จธ์ค
- dp
- dfs
- ๋ธ๋ฃจํธํฌ์ค
- Queue
- ๋ฐฑ์ค
- ๋ฐฑํธ๋ํน
- ๋นํธ์ฐ์ฐ์
- ์๊ณ ๋ฆฌ์ฆ
- ๋ถํ ์ ๋ณต
- ios
- WebView
- ์ ํด๋ฆฌ๋ ํธ์ ๋ฒ
- ๋ธ๋ฃจํธํฌ์ค ์๊ณ ๋ฆฌ์ฆ
- Today
- Total
๋ชฉ๋ก๐ค ์๊ณ ๋ฆฌ์ฆ/programmers (201)
MUKER_DEV with iOS
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๊ธฐ๋ณธ ํ์ด func solution(_ n:Int) -> Int { var result = 0 for i in 1...n { if n % i == 0 { result += 1 } } return result } ๊ณ ์ฐจํจ์ ํ์ด func solution(_ n:Int) -> Int { return (1...n).filter { n % $0 == 0 }.count }
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด func solution(_ s1:[String], _ s2:[String]) -> Int { var count = 0 for i in s1 { for j in s2 { if i == j { count += 1 } } } return count } ๊ณ ์ฐจํจ์ ์ฌ์ฉ func solution(_ s1:[String], _ s2:[String]) -> Int { return s1.filter{s2.contains($0)}.count }
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด - ๋ฐฐ์ด์ ๋ฒ์์ธ๋ฑ์ค๋ก ๊ฐ์ ธ์ฌ ๋ ArraySlice ํ์ ์ด๊ธฐ ๋๋ฌธ์ Array๋ก ํ๋ฒ ๋ฌถ์ด์ returnํด์คฌ๋ค. func solution(_ numbers:[Int], _ num1:Int, _ num2:Int) -> [Int] { return Array(numbers[num1...num2]) }
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด import UIKit func solution(_ quiz:[String]) -> [String] { var result: [String] = [] for i in quiz { var arr = i.split(separator: " ").map { String($0) } if arr[1] == "+" { if Int(arr[0])! + Int(arr[2])! == Int(arr[4]) { result.append("O") } else { result.append("X") } } else { if ..
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด import Foundation func solution(_ cipher:String, _ code:Int) -> String { var count = 1 var result = "" for i in cipher { if count % code == 0 { result += String(i) } count += 1 } return result } ๊ฐ์ ๋ ํ์ด - ์ฝ๋๊ธธ์ด ๊ฐ์ - ๊ณ ์ฐจํจ์ ์ฌ์ฉ - enumerated()๋ ๋ฌธ์์ด์ (index, element)์ธ ์ด๊ฑฐํ์ผ๋ก ๋ง๋ค์ด์ค๋ค. ๊ณ ์ฐจํจ์๋ฅผ ์ฌ..
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด func solution(_ price:Int) -> Int { switch price { case _ where price >= 500000 : return Int(Double(price) * 0.80) case _ where price >= 300000 : return Int(Double(price) * 0.90) case _ where price >= 100000 : return Int(Double(price) * 0.95) default : return price } }
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด func solution(_ numbers:[Int], _ k:Int) -> Int { var result = 1 guard k != 1 else { return 1 } for _ in 1...k-1 { result += 2 if result >= numbers.last! { result = result - numbers.last! } } return result } ์ถ์ฒ ํ์ด - ์ฝ๋๊ธธ์ด ๊ฐ์ - ๊ณ ์ฐจํจ์ ์ฌ์ฉ func solution(_ numbers:[Int], _ k:Int) -> Int {..
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด import UIKit func solution(_ my_string:String) -> String { return String(my_string.reversed()) }
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด import Foundation func solution(_ numbers:[Int], _ direction:String) -> [Int] { var arr = [Int]() if direction == "right" { arr.append(numbers.last!) for i in numbers { arr.append(i) } arr.removeLast() } else { arr = numbers arr.removeFirst() arr.append(numbers[0]) } return arr }
ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ ์ค์ฌ์ ๊ฐ๋ฐ์ ์ฑ์ฉ. ์คํ ๊ธฐ๋ฐ์ ํฌ์ง์ ๋งค์นญ. ํ๋ก๊ทธ๋๋จธ์ค์ ๊ฐ๋ฐ์ ๋ง์ถคํ ํ๋กํ์ ๋ฑ๋กํ๊ณ , ๋์ ๊ธฐ์ ๊ถํฉ์ด ์ ๋ง๋ ๊ธฐ์ ๋ค์ ๋งค์นญ ๋ฐ์ผ์ธ์. programmers.co.kr ๋์ ํ์ด import Foundation func solution(_ common:[Int]) -> Int { if common[1] - common[0] == common[2] - common[1] { return common.last! + common[1] - common[0] } else { return common.last! * common[1] / common[0] } }