์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
- ์คํ
- hash
- 1๋จ๊ณ
- ์ฝ๋ฉํ ์คํธ
- ๋ ์์ ํฉ
- ์๋ฐ
- jquery
- JSP
- ๋ฐฑ์ค c++
- ๋ฐฐ์ด
- ๋ฐฑ์ค
- Deque
- Servlet
- ํ์ด์ฌ
- ์ํด๋ฆฌ ์ฑ๋ฆฐ์ง
- ํ
- ๊ฐ๋ฆ
- Lambda
- ํฌ ํฌ์ธํฐ
- ํ๋ก๊ทธ๋๋จธ์ค
- ํด์
- MySQL
- ์ฝ๋์
- counter
- R
- ์คํ๋ง
- JavaScript
- Set
- ์ฅ๊ณ
- 2๋จ๊ณ
- Today
- Total
๋ชฉ๋กDeque (3)
Development
๋ด ์ฝ๋ def solution(cacheSize, cities): answer = 0 q = [] cities = [i.lower() for i in cities] if cacheSize==0: return len(cities)*5 for city in cities: if city in q: answer+=1 q.remove(city) q.append(city) else: answer+=5 if len(q) == cacheSize: q.pop(0) q.append(city) return answer LRU ์๊ณ ๋ฆฌ์ฆ์ ํ์ด์ง ๊ต์ฒด ์๊ณ ๋ฆฌ์ฆ ์ค์ ํ๋๋ก ๊ฐ์ฅ ์ค๋ซ๋์ ์ฐธ์กฐ๋์ง ์์ ํ์ด์ง๋ฅผ ๊ต์ฒดํ๋ ๊ธฐ๋ฒ์ด๋ค. ์ด์์ฒด์ ์๊ฐ์ ๋ฐฐ์ ์๋๋ฐ.. ์ค๋๋ง์ ๋ณธ๋ค. ์ด๋ฐ์์ผ๋ก ๋ฌธ์ ๋ ์ ์ฉ๋ ์ ์๋๊ฑธ ์ฒ์์์๋ค ใ ..
ํด ๋๋์ด ํ์๋ค!!!!! ์ฝ๋๊ฐ ๋ง์ด., ๋๋ฌ์ด๊ฑฐ๊ฐ๋ค ใ .ใ ๋ด ์ฝ๋ ์ค๋ช ํ๊ณ ๋นจ๋ฆฌ ๋ค๋ฅธ์ฌ๋๊บผ ๋ถ์ํด๋ด์ผ์ง... ๋ด ์ฝ๋ def solution(bridge_length, weight, truck_weights): from collections import deque crossing_truck = deque([]) cnt=0 i=0 while True: if i==len(truck_weights) and len(crossing_truck)==0: break if len(crossing_truck) !=0: if crossing_truck[0][1] == bridge_length: crossing_truck.popleft() if i!=len(truck_weights): if weight>= (truck..
ํ, ์คํ์ ์ฃผ์๊ฐ๊ฒฉ! ์ด๋ ค์ด ๋ฌธ์ ๋ ์๋๋ฐ.. ๋ฌธ์ ์ดํดํ๋๋ฐ ์๊ฐ์ด ์ข.. ๊ฑธ๋ ธ๋ค. ์์์ ํ์๋ ๊ธฐ๋ฅ๊ฐ๋ฐ์ด๋ ํ๋ฆฐํฐ๋ณด๋ค ํจ ์ฌ์ด๊ฑฐ๊ฐ๋ค!! ๊ทผ๋ฐ ํ ์คํ ๋ฌธ์ ๋ฐ.. ๋๋ ๊ทธ๋ฅ ์ด์คํฌ๋ฌธ์ผ๋ก ํ์๋ค. ํจ์จ์ฑ ํ ์คํธ ํต๊ณผํ๋ฉด ๋๊ฑด๊ฐ?..ใ ใ ๋ด ์ฝ๋ def solution(prices): answer = [] for i in range(len(prices)-1): answer.append(0) for j in range(i+1,len(prices)): if prices[i]