Notice
Recent Posts
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- UIKit
- 반응형프레임워크
- Swift디자인패턴
- 앱의생명주기
- iOS앱 디버깅
- SWIFT
- unittest
- alamofire
- ios면접
- ARC
- AutoLayout
- firestore
- HackersRank
- IOS
- RC
- Di
- firebase
- 시험에자주나오는것만
- RxSwift
- mrc
- ReactorKit UnitTest
- 카카오맵클론
- 코딩테스트입문
- Safari Inspector
- Swift코딩테스트
- algorithm
- Bubble Search
- hackerrank
- TDD
- 프로그래머스
Archives
- Today
- Total
샘성의 iOS 개발 일지
[Warm Up] Staircase 본문
728x90
문제 설명:
Staircase detail
This is a staircase of size : n = 4
#
##
###
####
Its base and height are both equal to n. It is drawn using # symbols and spaces. The last line is not preceded by any spaces.
Write a program that prints a staircase of size n.
내 풀이:
func staircase(n: Int) -> Void {
for i in 1...n {
// 띄어쓰기 먼저 반복 후, 마지막에 #가 출력되야 함
print(String(repeating: " ", count: n - i) + String(repeating: "#", count: i))
}
}
728x90
'Algorithm > HackerRank' 카테고리의 다른 글
[Implementation] Apple and Orange (0) | 2023.05.12 |
---|---|
[Implementation] Grading Students (0) | 2023.05.12 |
[Warm Up] Time Conversion (0) | 2023.05.11 |
[Warm Up] Birthday Cake Candles (0) | 2023.05.11 |
[Warm Up] Diagonal Difference (0) | 2023.05.11 |