์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 | 31 |
- Mac
- Cloud Firestore
- DispatchQueue
- Decodable
- Core Data
- UIRefreshController
- nodejs
- ์๊ณ ๋ฆฌ์ฆ
- Firestore
- Reduce
- ์ง๋ฒ๋ณํ
- AVAudioPlayer
- ios
- Codable
- RxSwift
- Encodable
- SWiFT
- CRUD
- mongoose
- Filter
- ์ฑ๋ง๋ค๊ธฐ
- ExpressJS
- Figma
- MongoDB
- components
- ํ๋ก๊ทธ๋๋จธ์ค
- ์ฑ๋์์ธ
- String.Index
- map
- Firestore CRUD
- Today
- Total
Focus On Develop ๐ค๐ค
[ํ๋ก๊ทธ๋๋จธ์ค] 2016๋ ๋ณธ๋ฌธ
<๋ฌธ์ >
<์ ๋ต์ง๊ธฐ>
์ด ๋ฌธ์ ๋ ๋งค๋ฌ ๋ช์ผ๊น์ง ์๋์ง ์๊ณ ์์ด์ผ ํ๋๊ฒ ํฌ์ธํธ๋ค.. (๋ค๋ค ์ฃผ๋จน์ง๊ณ ํฐ๋ฌ ์์๋ฌ ์์์ฅฌ..!?ใ ใ ๐) ์์ด~ ์ฝ๋ฉ์ธ๋ฐ ์์ผ ๊ตฌํ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ ์์๊น? ๋ผ๊ณ ์ ๊ทผํ๋ฉด ์ด๋ ค์์ง๋ค.. "๋งค๋ฌ ๋ช์ผ๊น์ง ์๋์ง ์ฝ๋๊ฐ ์๊ณ ์์ด์ผํ๋ค"๋ฅผ ๋ช ์ฌํ์. ํ๋์ฝ๋ฉ์ด ์๋๋๊น ์์ฌํ์..ใ ใ ๊ทธ๋ ๊ฒ ๋๋ฉด 1์1์ผ์ด ๊ธ์์ผ์ด๋๊น ์์ผ์ ๊ธ~๋ชฉ ์์๋๋ก ๊ฐ์ง๊ณ ์๊ณ , 1์ 1์ผ๋ถํฐ ์ ๋ ฅ์ผ๋ก ๋ค์ด์ค๋ ๋ ์ง๊น์ง ์ด ์ผ์ % 7๋ก ๊ตฌํ๋ฉด ๋ ๋ฏ ํ๋ค. ์ฌ๊ธฐ์ ํ๊ฐ์ง ์ฃผ์ํด์ผ ํ ์ ์, ์๋ฅผ๋ค์ด 1์2์ผ์ด๋ผ๊ณ "์ผ์"๊ฐ 2๊ฐ๋๋๊ฒ ์๋๋ผ 1์ด๋๋ค๋ ์ ์ด๋ค.ใ (-1์ ์์ง๋ง์)
<์ฝ๋>
let days31: [Int] = [1, 3, 5, 7, 8, 10, 12]
let days30: [Int] = [4, 6, 9, 11]
let weekDays: [String] = ["FRI","SAT","SUN","MON","TUE","WED","THU"]
func solution(_ a:Int, _ b:Int) -> String {
var totalDays = 0
var result: String
for i in 1 ..< a {
if days31.contains(i) {
totalDays += 31
} else if days30.contains(i) {
totalDays += 30
} else if i == 2 {
totalDays += 29
}
}
totalDays += (b-1)
return weekDays[(totalDays % 7)]
}
<Lesson Learned>
์ ๋ต์ ๋ฌด๋ํ ๋์๋๋ฐ.. ์..? ์ด๋ฒ์๋ ๋ค๋ฅธ์ฌ๋ ํ์ด๋ฅผ ๋ณด๋ reduce๋ฅผ ์ฌ์ฉํด์ ์ฝ๋๊ฐ ๋์ค์ด๋ค..?? ์..?? ๐ญ ๐ญ
์ธ์ ๊น์ง Lesson Learned๋ฅผ ์ฐ๋ฉด์ map, filter, reduce๋ฅผ ์ฌ์ฉํด์ผ๊ฒ ๋ค๊ณ ์จ์ผํ ๊น ใ .ใ ์ด๋ฒ์๋ ์ง์ง ์ด๋ป๊ฒ ์จ์ผํ ์ง ๋ชฐ๋๋๋ฐ.. ํํ
์ถ์ : ํ๋ก๊ทธ๋๋จธ์ค 2016๋
'iOS [Swift] > ์๊ณ ๋ฆฌ์ฆ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฐ์ด๋ฐ ๊ธ์ ๊ฐ์ ธ์ค๊ธฐ (0) | 2020.12.17 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] 3์ง๋ฒ ๋ค์ง๊ธฐ (0) | 2020.12.16 |
[ํ๋ก๊ทธ๋๋จธ์ค] K๋ฒ์งธ์ (0) | 2020.12.16 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ชจ์๊ณ ์ฌ (0) | 2020.12.16 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ฒด์ก๋ณต (0) | 2020.12.15 |