๊ณต๋ถ€ ์—ฐ์Šต์žฅ :-)

TIL_20180212 ~ 20180218

|

2018.02.12

  • ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ธฐ์ดˆ
    • ํ—ฌ๋กœ์ฝ”๋”ฉ chapter2 ์„ ํƒ์ •๋ ฌ
    • ์„ ํƒ์ •๋ ฌ์ฝ”๋“œ ์Šค์œ„ํ”„ํŠธ๋กœ ๋งŒ๋“ค์—ˆ๋‹ค
  • ์žํŒ๊ธฐ ๋ฏธ์…˜ ์ง„ํ–‰
    • ์Œ๋ฃŒ์ˆ˜์— itemCode์†์„ฑ ์ถ”๊ฐ€ํ•˜๋Š”๊ฑธ๋กœ ์ผ๋‹จ ํ•ด๊ฒฐ.
    • ๊ฐ์ฒด ์†์„ฑ์„ ๊ฑด๋“œ๋ฆฌ์ง€ ์•Š๊ณ  enum์„ ์ด์šฉํ•ด์„œ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ๋Š”๋ฐ, enum ์œผ๋กœ ๋งŒ๋“ค๋ฉด ๋” ๊ตฌ์กฐ๊ฐ€ ๋ณต์žกํ•ด์ง€๊ณ  ๊ฒ€์‚ฌํ•ด์•ผ ํ•  ๋‹จ๊ณ„๊ฐ€ ๊ธธ์–ด์ง€๋Š”๋ฐ ์–ด๋–ค ๊ฒŒ ๋” ํšจ์œจ์ ์ธ๊ฑด์ง€ ํ™•์‹ ์ด ๋“ค์ง€ ์•Š์•„์„œ ์ผ๋‹จ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ์ง„๋„๋ฅผ ๋‚˜๊ฐ€๋Š” ๊ฑธ๋กœ ๋งˆ์Œ์„ ๊ณ  enum์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ธฐ๋กœํ–ˆ๋‹ค. ์ด๊ฑด ํ”ผ๋“œ๋ฐฑ๊ณผ ์ฝ”๋“œ๋ฆฌ๋ทฐ๋ฅผ ๋ฐ›๊ณ  ๊ณ ์ณ๋‚˜๊ฐ€๋Š” ๋ถ€๋ถ„์ด ์ข€ ํ•„์š”ํ•  ๊ฒƒ ๊ฐ™๋‹ค.

2018.02.13

TIL

  • ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ธฐ์ดˆ
    • ํ—ฌ๋กœ์ฝ”๋”ฉ chapter3 ์žฌ๊ท€ ๊ณต๋ถ€!
      • keyword: ์Šคํƒ, ํ˜ธ์ถœ์Šคํƒ, ์žฌ๊ท€๋‹จ๊ณ„, ๊ธฐ๋ณธ๋‹จ๊ณ„
  • ์žํŒ๊ธฐ
    • ์Šคํ…3 ์š”๊ตฌ์‚ฌํ•ญ ์™„๋ฃŒ!
      • ์•ˆ๋˜์„œ ๋ช‡์ผ๋™์•ˆ ์ •์ฒด์ƒํƒœ์˜€๋Š”๋ฐ, ํ•„์š”์—†๋Š”๊ฑธ ์ฐจ๊ทผ์ฐจ๊ทผ ์ง€์šฐ๊ณ  ์ƒ๊ฐํ•˜๋‹ˆ ์ผ๋‹จ ์š”๊ตฌ์‚ฌํ•ญ๋Œ€๋กœ ๋Œ์•„๊ฐ€๊ฒŒ๋Š” ๋งŒ๋“  ๊ฒƒ ๊ฐ™๋‹ค.
      • ๋ณต์žกํ•ด์ง„ ๋กœ์ง๊ณผ ๋„ˆ๋ฌด ๊ฐ€์ง“์ˆ˜๊ฐ€ ๋งŽ์•„์ง„ ๊ตฌ์กฐ์ฒด๋ฅผ ์ค„์˜€๋”๋‹ˆ ํ•ด๊ฒฐ์ฑ…์ด ๋ณด์˜€๋‹ค.
      • JSON 2๋‹จ๊ณˆ๊ฐ€? ํ• ๋•Œ๋„ ๋„ˆ๋ฌด ๋ณต์žกํ•˜๊ฒŒ ์งœ์„œ ํ•œ๋ฒˆ ๊ธด ์ •์ฒด๊ธฐ๊ฐ€ ์™”์—ˆ๋Š”๋ฐ, ์—ญ์‹œ ์ด๋ฒˆ์—๋„ ํ•„์š”์—†๋Š” ๋™์ž‘๊ณผ ํ•„์š”์—†๋Š” ๊ตฌ์กฐ์ฒด๋ฅผ ๋„ˆ๋ฌด๋งŽ์ด ๋งŒ๋“ค์–ด๋†จ๋‹คโ€ฆ ์ข€ ๋” ๋””ํ…Œ์ผํ•˜๊ฒŒ ๋งŒ๋“ค๊ณ ์‹ถ์€ ์š•์‹ฌ๋•Œ๋ฌธ์— ์ถ”๊ฐ€ํ•˜๊ฒŒ๋˜์—ˆ๋Š”๋ฐ, ์ผ๋‹จ ๊ณต๋ถ€ํ•˜๋Š”(๋ฏธ์…˜์„ ์ˆ˜ํ–‰ํ•˜๋Š”)์ž…์žฅ์—์„œ๋Š” ์ผ๋‹จ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋จผ์ € ํ‘ธ๋Š”๊ฒŒ ๋จผ์ €๋‹ˆ๊นŒ ์š”๊ตฌ์‚ฌํ•ญ์—๋งŒ ์ง‘์ค‘ํ•˜๊ธฐ๋กœํ•˜๊ณ  ๋””ํ…Œ์ผํ•œ ๋ถ€๋ถ„์„ ๋‹ค ์ œ๊ฑฐํ–ˆ๋‹ค.
      • ์ผ๋‹จ ๋Œ์•„๊ฐ€๋‹ˆ ๋‹ค์‹œ ๊ณ ์ณ๋ณด๊ณ ์‹ถ์€ ๋งˆ์Œ๋„ ์ƒ๊ธฐ๊ณ , ๊ฐ„๋‹จํ•˜๋‹ˆ๊นŒ ์–ด๋””๊ฐ€ ๋ฌธ์ œ์ธ์ง€ ๋” ๋ฌธ์ œ์ ์ด ์ž˜ ๋ณด์˜€๋‹ค. ๋ณต์žกํ•˜๊ณ  ๋„ˆ๋ฌด ์˜ค๋žซ๋™์•ˆ ์ •์ฒด๋˜์–ด์žˆ์„๋•Œ๋Š” ์—†์•จ๊ฑด ์—†์• ๊ณ  ๊ณผ๊ฐํ•˜๊ฒŒ ๋‹ค์‹œ ์ƒ๊ฐํ•ด๋ณด๋Š”๊ฒŒ ๋” ๋‚˜์€ ํ•ด๊ฒฐ์ฑ…์ด ๋  ์ˆ˜๋„ ์žˆ๋‹ค!

2018.02.14

TIL

  • ์นด๋“œ๊ฒŒ์ž„step5 ํšŒ๊ณ , ์•„๋ž˜ ๋‚ด์šฉ ์œ„์ฃผ๋กœ ํšŒ๊ณ ํ•™๊ธฐ!
    • ์นด๋“œ comparable ๊ตฌํ˜„
    • ๊ฐ์ฒด์—ญํ•  ์žฌ๋ถ„๋‹ด : winning ์นด๋“œ ๋ฝ‘๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๋ฉด์„œ ์™ธ๋ถ€์—์„œ ์นด๋“œ๊ฐ’์„ ๊ฐ€์ ธ์™€์„œ ๋น„๊ตํ•˜๋ ค๊ณ  ํ–ˆ๋˜ ๊ฒƒ์„ ๋ฆฌ๋ทฐ๋ฅผ ๋ฐ›์€ ํ›„์—๋Š” ์นด๋“œ ๋‚ด์—์„œ ๋น„๊ตํ•ด์„œ ๊ฒฐ๊ณผ๊ฐ’์„ ์•Œ๋ ค์ฃผ๋Š” ๊ตฌ์กฐ๋ฅผ ์•Œ๊ฒŒ๋๋‹ค๋Š” ์ .
    • Hands๊ตฌ์กฐ์ฒด ๋ถ„๋ฆฌ : ๊ตฌํ˜„ํ–ˆ์„๋•Œ ๊ตฌ์กฐ์ ์œผ๋กœ ์นด๋“œ pair๋งŒ ๋น„๊ตํ•ด์„œ ์ •๊ตํ•œ ๊ฒฐ๊ณผ๋ฅผ ๋‚ด๊ธฐ๊ฐ€ ์–ด๋ ค์› ๊ณ  ํƒ‘์นด๋“œ๋ฅผ ์•Œ์•„์•ผ ๋˜๋Š” ๋ฌธ์ œ์ ์ด ์žˆ์—ˆ๋Š”๋ฐ ๊ทธ๋ ‡๊ฒŒ hands๋ฅผ ๊ตฌํ˜„ํ•˜๊ธฐ์œ„ํ•ด์„œ ์•„์˜ˆ ๊ตฌ์กฐ์ฒด๋ฅผ ๋งŒ๋“ค์—ˆ๋˜ ์ 

2018.02.15 - 17

TODO

  • ์„ค๋‚ ์ด๋ผ ์นœ์ฒ™ ์ง‘์—๊ฐ€์•ผํ•ด์„œ ๊ณต๋ถ€๋Š” ๊ทธ๋ฆฌ ๋งŽ์ด ๋ชปํ•  ๊ฒƒ ๊ฐ™๊ณ , ์‹œ๊ฐ„์ด ๋งŽ์ด๋“ค์ง€๋งŒ ์™• ์ง‘์ค‘์ด ๊ทธ๋ฆฌ ํ•„์š”์น˜์•Š์€? ์ผ๋“ค์„ ํ•˜๊ธฐ๋กœํ–ˆ๋‹ค.
  • ๋ธ”๋กœ๊ทธ ์ •๋ฆฌ : swift๋‚ด์šฉ์„ ์ •๋ฆฌ๋ฅผ ๋งŽ์ด ๋ชปํ–ˆ๋Š”๋ฐ, swift in Date ์ฃผ์ œ๋กœ ์˜ค๋žœ๋งŒ์— ํ•˜๋‚˜ ์˜ฌ๋ฆฌ๊ธฐ
  • JSON parser ํ”ผ๋“œ๋ฐฑํ•˜๊ธฐ, ์˜ˆ์ „ ํ”ผ๋“œ๋ฐฑ๊ณผ PR ๋ฆฌ๋ทฐ ์ฝ”๋ฉ˜ํŠธ ์ฝ์–ด๋ณด๊ธฐ - 2์›” ๊ณ„ํš์ค‘ ํ•˜๋‚˜์˜€์Œ
  • ํ•ด์ปค๋žญํฌ ๋ฌธ์ œํ’€๊ธฐ ๊ผญ ๋งค์ผ 3๋ฌธ์ œ!
  • ์žํŒ๊ธฐ ๋ฆฌํŒฉํ† ๋ง
    • ์Œ๋ฃŒ๊ฐ€ ํ•œ๊ฐœ๋‚จ์•˜์„๋•Œ ๋‚˜๋จธ์ง€ ํ•œ๊ฐœ๋ฅผ ์‚ฌ๋ฉด removeํ•ด๋ฒ„๋ฆฌ๊ณ  ๋ฆฌํ„ดํ•ด์„œ ์•ˆ๋จ!!(๋ฆฌ๋ฌด๋ธŒ ํ•œ ๋’ค์— ๋ฆฌํ„ดํ•˜๋‹ˆ๊นŒ)
  • ํ•ด์ปค๋žญํฌ ํ‘ผ ๋ฌธ์ œ์ค‘์— ๋ฌธ์ž์—ด ์ž๋ฅด๋Š” ์ž‘์—…์„ ๋งŽ์ด ํ•œ ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š”๋ฐ (Time Conversion)์Šค์œ„ํ”„ํŠธ์—์„œ ๋ฌธ์ž์—ด ์ž๋ฅด๋Š”๊ฒŒ ์ข€ ๊นŒ๋‹ค๋กญ๊ณ  ๋‹จ์œ„๋ณ€ํ™˜๊ธฐ๋•Œ๊ฐ€ ์ƒ๊ฐ๋‚˜์„œ ์ฝ”๋“œ์ข€ ์ •๋ฆฌํ•˜๋ ค๊ณ  ๋ณต๋ถ™! ```Swift import Foundation

let time = readLine()!

func timeConversion(_ time: String) -> String { var range = time.index(time.startIndex, offsetBy: 8)..<time.endIndex let unit = String(time[range]) let hourRange = time.startIndex..<time.index(time.startIndex, offsetBy: 2)

switch unit {
case "AM":
    let hour = String(time[hourRange])
    range = time.startIndex..<time.index(time.endIndex, offsetBy: -2)
    if hour == "12" {
        return String(time.replacingOccurrences(of: hour, with: "00")[range])
    }
    return String(time[range])
case "PM":
    let hour = String(time[hourRange])
    if hour == "12" {
        range = time.startIndex..<time.index(time.endIndex, offsetBy: -2)
        return String(time[range])
    }
    let convertedHour = convert(hour)
    range = time.startIndex..<time.index(time.endIndex, offsetBy: -2)
    return String(time.replacingOccurrences(of: hour, with: convertedHour)[range])
default:
    return time
}
return time }

func convert(_ hour: String) -> String { return String(24-(12 - (Int(hour)!))) }

print(timeConversion(time))

```

2018.02.15 - 17

TIL

  • ํ•ด์ปค๋žญํฌ ๋ฌธ์ œ 2๊ฐœ ํ’ˆ
  • JSON feedback ์ •๋ฆฌํ•จ - step4
  • VendingMachine์—์„œ buy / remove๋ฒ„๊ทธ ํ•ด๊ฒฐ
  • ํ—ฌ๋กœ์ฝ”๋”ฉ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํ€ต์ •๋ ฌ ์ฝ์Œ

2018.02.18

TIL

  • github ๋ธ”๋กœ๊ทธ ๊ตฌ๊ธ€ ๊ฒ€์ƒ‰์—”์ง„์— ๋“ฑ๋ก! ์ด์ œ ๊ฒ€์ƒ‰ํ•˜๋ฉด ๊ตฌ๊ธ€์— ๋‚˜์˜จ๋‹ค.
  • github ๋ธ”๋กœ๊ทธ ๋„ค๋น„๊ฒŒ์ด์…˜, ํ™ˆํ™”๋ฉด, ์นดํ…Œ๊ณ ๋ฆฌ ํŽ˜์ด์ง€ ์ปค์Šคํ…€!

Comments