Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🧑💻 언어 및 제출 결과
TypeScript, ...🧠 풀이 설명
ex) [7, 1, 5, 3, 6, 4] → 1이 제일 작음 7, 1 날려버리기 [5, 3, 6, 4]
내가 푼 코드
이렇게 했을 경우 [7,1,5,3,6,4], [7,6,4,3,1]은 내가 원하는대로 답이 잘 나왔는데 [2,4,1]에서는 답이 제대로 나오지 않았다. 최소 가격과 최대 가격만 비교하는게 아니라 계속 빼기를 해서 결과를 낸 다음에 그 값이 제일 큰 경우를 반환하는게 옳다고 생각했다.
실제 정답 코드
📊 시간/공간 복잡도
O(n)O(1)📝 추가 설명 (선택)
🙋♂️ 리뷰어에게