일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- cte
- 조합
- lv4
- 프로그래머스
- sql
- Stack
- mysql
- time complexity
- hackerrank
- Queue
- coding
- 파이썬
- itertools
- 코딩테스트
- Growth hacking
- tableau
- AARRR
- counter
- LeetCode
- import re
- 코테
- 코딩
- 완전탐색
- level4
- lambda
- join
- Level2
- programmers
- coding test
- python
Archives
- Today
- Total
목록del (1)
ror_coding
[Programmers] 햄버거 만들기 - 133502
시간 초과로 stack 이용해서 O(n)로 풀기. Question 상수에게 전해지는 재료의 정보를 나타내는 정수 배열 ingredient가 주어졌을 때, 상수가 포장하는 햄버거의 개수를 return 하도록 solution 함수를 완성하시오. Code : Time Complexity O(n) def solution(ingredient): answer = 0 stack = [] for i in ingredient: # O(n) stack.append(i) # O(1) if stack[-4:] == [1,2,3,1] : answer += 1; del stack[-4:] # O(1) return answer Code 2 : Time Complexi..
Coding Test/Python
2024. 10. 23. 14:44