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.
✅ 1806 - 부분합
2-1). 부분합이 S이하이고 right가 배열의 길이를 벗어나지 않았다면, 포인터가 가리킨 원소들의 합(currSum)을 저장
2-2). currSum이 S이상이라면, i와 right의 간격을 구하고, S이상이 되다는 의미로 flag를 true로 갱신
2-3). 부분합이 S이상인 경우들의 두 포인터의 간격들 중 최솟값을 구함
2-4). 다음 부분합을 구하기 위해 curSum에서 i위치의 원소 값을 뺌
✅ 2531 - 회전초밥
6-1-1). 이전 주기에서의 시작 스시의 인덱스 startIdx를 구함
6-1-2). 현재 주기에서는 먹지 않으므로 해당 인덱스의 eat 원소를 1감소
6-1-3). 바로 전단계에서 변화된 eat원소가 0이라면 현재 주기에서 먹지 않는 종류 이므로 cnt를 1감소
6-2-1). 현재 주기에서의 마지막 스시의 인덱스 endIdx를 구함
6-2-2). 해당 인덱스의 eat원소가 0이라면 현재 주기에서 처음 먹는 종류 이므로 cnt를 1증가
6-2-3). 현재 주기에서 먹었으므로 해당 인덱스의 eat 원소를 1증가
6-3). 현재 cnt를 curCnt 변수에 저장해두고 쿠폰을 쓰지 않았다면 1증가
6-4). curCnt와 max를 비교해 최댓값 갱신