일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Generator
- Regular Expression
- Substring with Concatenation of All Words
- Protocol
- Python Code
- 109. Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- 프로그래머스
- attribute
- Class
- 43. Multiply Strings
- Python
- 30. Substring with Concatenation of All Words
- Decorator
- shiba
- Python Implementation
- 밴픽
- LeetCode
- Convert Sorted List to Binary Search Tree
- 315. Count of Smaller Numbers After Self
- 시바견
- kaggle
- t1
- 운영체제
- 715. Range Module
- DWG
- concurrency
- 파이썬
- iterator
- data science
Archives
- Today
- Total
목록징검다리 (1)
Scribbling
프로그래머스: 징검다리
개인적으론 매우 어려웠던 문제이다. Binary Search를 이용하라는 힌트가 있음에도 풀지 못하였다. 처음 떠올렸던 방식은 O(N**2)이었는데 N이 너무 커서 안될것 같았다. 이래저래 Binary Search를 적용할 방안을 떠올려보았지만, 끝까지 생각이 나지 않아 구글링을 해따... 아이디어는 매우 간단하다. --> 돌 사이의 간격에 대해 binary search를 하면된다. 효율성은 O(log(D)*N)이므로 최선의 알고리즘이다. def solution(distance, rocks, n): answer = -1 rocks.sort() rocks.append(distance) l, r = 0, distance while l = mid: prev = rock else: num_removed += 1..
Computer Science/Coding Test
2021. 11. 3. 12:12