일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- 43. Multiply Strings
- 컴퓨터의 구조
- Python Code
- 파이썬
- Class
- 30. Substring with Concatenation of All Words
- 프로그래머스
- 715. Range Module
- Generator
- Python Implementation
- kaggle
- data science
- DWG
- Python
- Protocol
- attribute
- 109. Convert Sorted List to Binary Search Tree
- LeetCode
- shiba
- 315. Count of Smaller Numbers After Self
- Convert Sorted List to Binary Search Tree
- Decorator
- Regular Expression
- 운영체제
- 시바견
- Substring with Concatenation of All Words
- t1
- 밴픽
- concurrency
- iterator
Archives
- Today
- Total
목록도둑질 (1)
Scribbling
프로그래머스: 도둑질
연이은 값을 선택할 수 없는 문제는 전형적인 DP 문제로 많이 접해보았을 것이다. 다만 이 문제는 첫 번째 값과 마지막 값을 동시에 선택할 수 없다는 조건이 추가되어있다. 이에 따라, 첫 번째 값을 선택가능한 case와 마지막 값을 선택 가능한 case로 나누어 그 중 최댓값을 return한다. 1) 0th idx ~ (n-1)th idx 2) 1th idx ~ (n)th idx def solution(money): dp1 = [0] * (len(money) - 1) dp1[0] = money[0] dp1[1] = max(money[0], money[1]) for i in range(2, len(money)-1): dp1[i] = max(dp1[i-2]+money[i], dp1[i-1]) dp2 = [0..
Computer Science/Coding Test
2021. 10. 26. 22:17