일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 컴퓨터의 구조
- t1
- concurrency
- Convert Sorted List to Binary Search Tree
- 프로그래머스
- kaggle
- iterator
- shiba
- Substring with Concatenation of All Words
- 43. Multiply Strings
- attribute
- 30. Substring with Concatenation of All Words
- Class
- Python
- 109. Convert Sorted List to Binary Search Tree
- 밴픽
- Protocol
- DWG
- 시바견
- Python Implementation
- 715. Range Module
- Decorator
- data science
- 315. Count of Smaller Numbers After Self
- Regular Expression
- Python Code
- 운영체제
- LeetCode
- 파이썬
- Generator
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