0706
화이팅
풀만큼 풀고오자
후회 ㄴㄴ
코테
- 프로그래머스: 공원
- all()은 파라미터에 있는 모든 값이 True인지 확인할 때 사용
- lst 안에 있는 원소가 temp 미만인지 확인하려면
if all(x < temp for x in lst):
- 프로그래머스: 추억 점수
- 딕셔너리 이용
- 프로그래머스: K번째수
- array.sort()는 원본 배열 정렬
- sorted(array)는 새로운 배열 반환 정렬
- 프로그래머스: 최소직사각형
- 가장 긴 변은 가로로
- 가장 짧은 변은 세로로
python
def solution(sizes):
rotated = []
for w, h in sizes:
rotated.append([max(w, h), min(w, h)])
max_w = max(w for w, h in rotated)
max_h = max(h for w, h in rotated)
return max_w * max_h
- 프로그래머스: 더 맵게
- import heapq
- heapq.heapify
- heapq.heappop(heap)
- heapq.heappush(heap, x)
- 프로그래머스: 기능개발
- 큐를 두 번 이용해서 숫자 비교
python
while days:
base_day = days.popleft()
count = 1
while days and days[0] <= base_day:
days.popleft()
count += 1
python
def palin(s, l, r):
while l < r:
if s[l] != s[r]:
return False
l += 1
r -= 1