πŸ‘©πŸ»‍πŸ’» iOSun
article thumbnail
[ν”„λ‘œκ·Έλž˜λ¨ΈμŠ€] swift ν˜Έν…” λŒ€μ‹€

문제 μ„€λͺ… λͺ‡κ°œμ˜ 객싀이 ν•„μš”ν•œμ§€ κ΅¬ν•˜λŠ” 문제 ν•œ 객싀을 μ΄μ–΄μ„œ μ‚¬μš©ν•˜λ €λ©΄ μ²­μ†Œμ‹œκ°„ 10뢄을 더해야 ν•œλ‹€. 문제 풀이 1. μ˜ˆμ•½ μ‹œμž‘ μ‹œκ°„ κΈ°μ€€μœΌλ‘œ μ •λ ¬ν•œλ‹€. 2. μ‹œκ°„μ„ λΆ„μœΌλ‘œ κ³„μ‚°ν•œλ‹€. 10:10 -> 10*60 + 10 = 610 3. 객싀 번호λ₯Ό λ°°μ •ν•˜κ³  λ§Œμ•½ λ°°μ •λœ μ˜ˆμ•½μ‹œκ°„μ˜ λλ‚˜λŠ” μ‹œκ°„+10보닀 μ˜ˆμ•½ μ‹œμž‘μ‹œκ°„μ΄ λ‚˜μ€‘μ΄λ©΄ κ·Έ 객싀을 이어 μ‚¬μš©ν•œλ‹€. import Foundation func solution(_ book_time:[[String]]) -> Int { var answer = 0 let bookTime = book_time.sorted(by: {$0[0] < $1[0]}) var bookNum = Array(repeating: 0, count: bookTime.count) // κ°μ‹€λ²ˆν˜Έ..

article thumbnail
[CS λ©΄μ ‘ 질문] ν”„λ‘œμ„ΈμŠ€(1)
CS/운영체제 2023. 5. 17. 22:09

ν”„λ‘œμ„ΈμŠ€μ™€ μŠ€λ ˆλ“œμ˜ μ°¨μ΄λŠ” λ¬΄μ—‡μΈκ°€μš”? ν”„λ‘œμ„ΈμŠ€λž€ .exe같은 아직 μ‹€ν–‰λ˜μ§€ μ•Šμ€ νŒŒμΌμ„ ν”„λ‘œκ·Έλž¨μ΄λΌκ³  ν•˜λŠ”λ° κ·Έ ν”„λ‘œκ·Έλž¨μ„ μ‹€ν–‰μ‹œν‚€λ©΄ ν”„λ‘œμ„ΈμŠ€λ‹€. 즉 μ»΄ν“¨ν„°μ—μ„œ μ‹€ν–‰λ˜κ³  μžˆλŠ” ν”„λ‘œκ·Έλž¨μ΄λ‹€. μŠ€λ ˆλ“œλž€ ν”„λ‘œμ„ΈμŠ€κ°€ 할당받은 μžμ›μ„ μ΄μš©ν•˜λŠ” μ‹€ν–‰ νλ¦„μ˜ λ‹¨μœ„μ΄λ‹€. λ‘˜μ˜ 큰 μ°¨μ΄λŠ” μŠ€λ ˆλ“œλŠ” μŠ€λ ˆλ“œλΌλ¦¬ λ©”λͺ¨λ¦¬λ₯Ό κ³΅μœ ν•˜μ§€λ§Œ ν”„λ‘œμ„ΈμŠ€λŠ” μžμ‹ μ˜ μžμ›λ§Œ 접근이 κ°€λŠ₯ν•˜λ‹€. λ”°λΌμ„œ ν•œ μŠ€λ ˆλ“œκ°€ μ’…λ£Œλœλ‹€λ©΄ λ‹€λ₯Έ μŠ€λ ˆλ“œμ—κ²Œ 영ν–₯을 λΌμΉ˜μ§€λ§Œ ν”„λ‘œμ„ΈμŠ€λŠ” ν•œ ν”„λ‘œμ„ΈμŠ€κ°€ μ’…λ£Œλ˜μ–΄λ„ λ‹€λ₯Έ ν”„λ‘œμ„ΈμŠ€μ—κ²Œ 영ν–₯을 λΌμΉ˜μ§€ μ•ŠλŠ”λ‹€. κ΅μ°©μƒνƒœλž€ 무엇이며, κ΅μ°©μƒνƒœκ°€ λ°œμƒν•˜κΈ° μœ„ν•΄μ„œλŠ” μ–΄λ–€ 쑰건이 μžˆμ–΄μ•Ό ν•˜λ‚˜μš”? κ΅μ°©μƒνƒœλž€ ν”„λ‘œμ„ΈμŠ€ or μŠ€λ ˆλ“œλ“€μ΄ μ„œλ‘œ ν•„μš”ν•œ μžμ›μ„ ν•œμ •μ μœΌλ‘œ μ„œλ‘œ 가지고 μžˆλŠ” 것이닀. ꡐ착 μƒνƒœ λ°œμƒ 쑰건은 4가지이고 λͺ¨λ‘ μΆ©μ‘±..

article thumbnail
[Swift Language Guide] λ¬Έμžμ—΄κ³Ό 문자 (Strings and Characters)
Swift Language Guide 2023. 5. 16. 22:15

// λ¬Έμžμ—΄ λ¦¬ν„°λŸ΄μ— 특수 문자 let sparklingHeart = "\\u{1F496}" // πŸ’–, Unicode scalar U+1F496 // λ¬Έμžμ—΄ λ³€κ²½ var variableString = "Horse" variableString += " and carriage" // "Horse and carriage" λ¬Έμžμ—΄μ€ κ°’(value) νƒ€μž…μ΄λ‹€. 원본이 μ•„λ‹Œ μƒˆλ‘œμš΄ 볡사본이 μ „λ‹¬λœλ‹€. μœ λ‹ˆμ½”λ“œ (Unicode) 인코딩, ν‘œκΈ°, 그리고 λ‹€λ₯Έ μ“°κΈ° μ‹œμŠ€ν…œμ—μ„œμ˜ ν…μŠ€νŠΈ ν”„λ‘œμ„Έμ‹±μ„ μœ„ν•œ ꡭ제 ν‘œμ€€μ΄λ‹€. Swift의 String κ³Ό Character νƒ€μž…μ€ μœ λ‹ˆμ½”λ“œλ₯Ό μ™„λ²½ν•˜κ²Œ μ§€μ›ν•œλ‹€. Swift의 κΈ°λ³Έ String νƒ€μž…μ€ μœ λ‹ˆμ½”λ“œ 슀칼라 κ°’ (Unicode scalar values) μœΌλ‘œλΆ€ν„° 생성 var ..

article thumbnail
[Swift Language Guide] κΈ°λ³Έ μ—°μ‚°μž (Basic Operators)
Swift Language Guide 2023. 5. 16. 22:12

λŒ€μž… μ—°μ‚°μž (Assignment Operator) if x = y { // ν‹€λ¦° 문법, λŒ€μž… μ—°μ‚°μžλŠ” 값을 λ¦¬ν„΄ν•˜μ§€ μ•ŠμŒ } μ‚°μˆ  μ—°μ‚°μž (Arithmetic Operators) 1 + 2 // equals 3 5 - 3 // equals 2 2 * 3 // equals 6 10.0 / 2.5 // equals 4.0 값이 μ˜€λ²„ν”Œλ‘œμš° λ˜λŠ” 것을 ν—ˆλ½ν•˜μ§€ μ•ŠμŒ λ‚˜λ¨Έμ§€ μ—°μ‚°μž (Remainder Operator) -9 % 4 // -9 = (4*-2) + (-1) a = (b x some multiplier) + remainder κ³„μ‚°μ‹μœΌλ‘œ λ‚˜λ¨Έμ§€ 계산 단항 λΊ„μ…ˆ μ—°μ‚°μž (Unary Minus Operator) & 단항 λ§μ…ˆ μ—°μ‚°μž (Unary Plus Operator) // 단항 λΊ„μ…ˆ μ—°μ‚°μž let th..

profile on loading

Loading...