This repository was archived by the owner on Mar 18, 2024. It is now read-only.
[2023-10-02] wooyeol #296#314
Merged
Merged
Conversation
Closed
zsmalla
approved these changes
Oct 8, 2023
Contributor
zsmalla
left a comment
There was a problem hiding this comment.
갠적으로 머리 깨질 것 같았던 문제인데, 참고해주신 풀이가 와닿았어서 다시 한 번 생각해볼 수 있었던 것 같아요! 고생하셨습니다~
Contributor
There was a problem hiding this comment.
이렇게 먼저 역으로 한 인덱스에서 가질 수 있는 최대값을 정의해주는 방법이 훨씬 와닿았던 것 같습니다!
Contributor
There was a problem hiding this comment.
저도 이 부분을 스택에 남은 원소들에 대해 처리해줬었는데 이렇게 구현하는게 훨씬 간결하고 가독성이 좋은 것 같아요!! 고생하셨습니다 우열님 👍👍
ksumini
approved these changes
Oct 9, 2023
Contributor
There was a problem hiding this comment.
저도 이 부분을 스택에 남은 원소들에 대해 처리해줬었는데 이렇게 구현하는게 훨씬 간결하고 가독성이 좋은 것 같아요!! 고생하셨습니다 우열님 👍👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
주식가격
https://school.programmers.co.kr/learn/courses/30/lessons/42584?language=python3
풀이시간
11:30 ~ 11:50 (20분)
문제 조건
1 <= prices의 각 가격 <= 10,000
2 <= prices의 길이 <= 100,000
시간 복잡도 :
O(N(N+1)/2)
접근법
무슨 알고리즘으로 풀이 할 수 있을까? -> 큐 와 스택
문제를 잘못 읽어 10,000개의 데이터 인줄 알고 시간 복잡도를 생각하지않고 풀이했는데
다시보니 100,000개인 것을 확인하였습니다.
그럼 이 풀이로는 풀이가 되지 않아야하는 의아함이 들어 다른 풀이를 참조하였습니다.
풀이 참고 : https://velog.io/@soo5717/프로그래머스-주식가격-Python
해당 풀이를 참고했을 때 2배 정도 빠른 효율성 테스트 결과를 확인 할 수 있었습니다.