전체 글 (31) 썸네일형 리스트형 니트코드 9번 알고리즘 : 피보나치 함수 니트코드 링크 : https://neetcode.io/courses/dsa-for-beginners/9 NeetCode neetcode.io 재귀적 방법 :# Recursive implementation to calculate the n-th Fibonacci numberdef fibonacci(n): # Base case: n = 0 or 1 if n 반복적 방법 : 시간 복잡도 : 재귀적 : O(2^n)반복적 : O(n) 백준1788 https://www.acmicpc.net/problem/1788 참고피보나치 수열 알고리즘을 해결하는 5가지 방법 https://shoark7.github.io/programming/algorithm/%ED%94%BC%EB%B3%B4%EB%82%98.. input 받는 법 여러가지 1. 변수 따로 받기x,y = input().split(' ')x,y = map(int,input().split(' ')) 2. 리스트로 받기x = input.split(' ') #x = list(input.split(' ')) 할 필요 없음x = list(map(int,input().split(' '))) 3. input 더 빨리 받는 방법 input() 대신 sys.stdin.readline().rstrip()x = list(map(int,(sys.stdin.readline().rstrip().split(' ')))) 1.15 코테 일지 1. 배열 복사https://leetcode.com/problems/concatenation-of-array/concatenation of array Concatenation of Array - LeetCodeCan you solve this real interview question? Concatenation of Array - Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 leetcode.com나는 밑에와 같은 코드를 짯다. ans= [] ans[:] = nums .. 이전 1 ··· 7 8 9 10 11 다음