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 | 31 |
Tags
- lock based queue
- pccp 기출문제 풀이
- boj 11657
- making anagrams
- lock free stack
- 프로그래밍공부
- special string again
- count triplets
- the maximum subarray
- find the running median
- ice cream parlor
- find the town judge
- string construction
- PCCE
- LCS
- c++
- 지게차와 크레인
- the longest increasing subsequence
- 브루트포스
- pcce 기출문제 풀이
- lock based stack
- boj 1074
- DirectX
- DirectX12
- gas
- boj 1717
- 2025 프로그래머스 코딩챌린지 1차예선
- dp
- boj 6443
- two characters
Archives
- Today
- Total
목록python 주식가격 (1)
오구의코딩모험

[코딩테스트 고득점 KIT - 스택/큐] 이중 for문을 이용하여 기준으로 둔 i번째 가격이 그 다음에 나올 j초 후 가격과 비교하며 cnt 값을 증가시켰다. 마지막 값과 비교를 마치거나, 기준 가격보다 떨어진 경우 answer 값을 반환해준다. 마지막 가격은 비교할 대상이 없으므로 제외 시켰다가, 마지막에 0 값을 대입해주었다. 끝 def solution(prices): answer = [] for i in range(len(prices)): cnt = 1 for j in range(i+1,len(prices)): if prices[i] prices[j]: answer.append(cnt) break answer.append(0) return answer
프로그래밍 공부/프로그래머스
2022. 12. 30. 21:40