YoonYn9915/ 4월 4주차/ 3문제 #202
Merged
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.
🌱WIL
이번 주는 투 포인터 혹은 이분탐색과 관련된 문제를 발제했다. 이전에도 부분합, 블랙 프라이데이 등의 문제로 이 주제를 접했었는데, 그때마다 힌트없이는 못 풀었었다. 근데 코테에 자주 나오는 유형은 아니라고 해서 dp, 그래프, 구현, 그리디 등의 문제를 더 중요시 했었는데 이번 코테 풀 때 나와서 복습 차 이 주제를 선정했다.
과제 문제를 어떻게 풀까... 하다가
[-2 6 -97 -6 98]에서 [6, -6, -2]를 골라버리면서 (6과 -6의 합이 0이니까 이것을 우선 뽑고 나머지 중 가장 작은 -2를 뽑은 로직) 실패.left,mid,right)를 써서 left와 right 사이에 모든 값을 하나씩 mid로 지정하여 비교해가며 풀이했는데, 문제를 풀다 보니 이 방법은 O(N2)으로 시간 초과로 실패.i)하고, 나머지 두 값을 투포인터로 찾아야 한다는 것을 알게 되었다. 쉬운 로직이었는데 풀때는 왜 생각이 안난건지 모르겠다.🚀주간 목표 문제 수: 3개
백준 #2470. 두 용액: 투 포인터 / 골드 5
정리한 링크: (바로가기)
🚩제출한 코드
백준 #2473. 세 용액: 투 포인터 / 골드 3
정리한 링크: (바로가기)
🚩제출한 코드
💡TIL
옛날 Python 2에서는 int와 long이 구분되었는데, Python 3부터는 둘이 통합되어 int 하나만 남았고, 크기 제한이 사라졌다.
정리하면:
Python 3의 int형은 메모리가 허용하는 한 무한대에 가깝게 커질 수 있다.
백준 #2240. 자두 나무: dp / 골드 5
정리한 링크: (바로가기)
🚩제출한 코드
💡TIL