티스토리 뷰
728x90
class Solution {
public int maxProfit(int[] prices) {
int buy = Integer.MIN_VALUE;
int cooldown = 0;
int sell = 0;
for (int p : prices) {
buy = Math.max(buy, cooldown - p);
cooldown = Math.max(cooldown, sell);
sell = Math.max(sell, buy + p);
}
return sell;
}
}
https://gonewbie.github.io/2020/02/26/daily-algorithm-best-time-to-buy-and-sell-stock/
https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/
728x90
'공부' 카테고리의 다른 글
[spark] RDD, DataFrame (0) | 2022.09.03 |
---|---|
[spark] lazy evalution (1) | 2022.09.03 |
[github] Why am I still getting "You've used 100% of included services for GitHub Storage (GitHub Actions and Packages)" after deleting all Artifacts? (0) | 2022.08.31 |
[docker] Dockerfile (sh file) (0) | 2022.08.31 |
[aws] emr create-cluster --configurations file:// (0) | 2022.08.31 |
댓글
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 메디파크 내과 전문의 의학박사 김영수
- 테슬라 레퍼럴 코드 확인
- 테슬라 리퍼럴 코드
- 레퍼럴
- follower
- 유투브
- 개리마커스
- Kluge
- 테슬라 리퍼럴 코드 생성
- 모델 Y 레퍼럴
- COUNT
- 할인
- 책그림
- 어떻게 능력을 보여줄 것인가?
- 테슬라 리퍼럴 코드 혜택
- 연애학개론
- 인스타그램
- wlw
- 클루지
- 테슬라 레퍼럴 적용 확인
- 김달
- 테슬라 추천
- Bot
- 테슬라 레퍼럴
- 테슬라
- 테슬라 크레딧 사용
- 모델y
- 팔로워 수 세기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함