Notice
Recent Posts
Recent Comments
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 |
Tags
- swift
- gitlabci/cd
- 자료구조
- 클린아키텍처
- mvvm
- Content Compression Resistance priority
- Union-Find
- OperationQueue
- ai expo
- LLM
- gitlab
- rxswift
- IOS
- CI/CD
- CICD
- cleanarchitecture
- 동시성프로그래밍
- Content Hugging priority
- 동작과정
- RxSwift요약
- RxCocoa
- AI
- swift알고리즘
- 애플인텔리전스
- 오토레이아웃
- 알고리즘
- 백준
- apple intelligence
- Autolayout
- ReactiveX
Archives
- Today
- Total
목록재귀함수 (1)
JosephCha의 개발일지

https://www.acmicpc.net/problem/10872 재귀 단계 피보나치 수 역시 단순 for문으로도 구할 수 있지만, 학습을 위해 재귀를 써 봅시다. www.acmicpc.net 코드 import Foundation let a = readLine() func recursive(_ n:Int) -> Int{ if n == 0 { return 0 } else if n == 1{ return 1 } else { return n * recursive(n-1) } } let b = Int(a!) print(recursive(b!)) 설명 컴공 1학년때, 나를 괴롭히던 재귀 함수다. 팩토리얼은 해당 숫자에서 1까지의 곱을 의미한다. 무슨소린지 헷갈리니, 예시를 들자면 ex) 5!(5의 팩토리얼) -..
알고리즘 및 자료구조
2021. 7. 28. 13:51