Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- lock based stack
- DirectX12
- the maximum subarray
- 지게차와 크레인
- count triplets
- boj 1717
- DirectX
- dp
- pccp 기출문제 풀이
- special string again
- boj 11657
- 2025 프로그래머스 코딩챌린지 1차예선
- string construction
- find the town judge
- c++
- boj 1074
- boj 6443
- PCCE
- lock free stack
- 브루트포스
- 프로그래밍공부
- making anagrams
- lock based queue
- ice cream parlor
- LCS
- the longest increasing subsequence
- pcce 기출문제 풀이
- 비밀 코드 해독
- find the running median
- two characters
Archives
- Today
- Total
오구의코딩모험
[Python] 같은 숫자는 싫어 본문
반응형
[코딩테스트 고득점 KIT - 스택/큐]
리스트를 인덱스 순서대로 검사하며
중복이 아닐 경우에만,
정답 리스트에 추가한다.
def solution(arr):
answer = [arr[0]]
for idx in range(len(arr)):
if answer[-1] != arr[idx]:
answer.append(arr[idx])
return answer
반응형
'프로그래밍 공부 > 프로그래머스' 카테고리의 다른 글
[Python] 기능개발 (1) | 2022.12.26 |
---|---|
[Python] 올바른 괄호 (0) | 2022.12.24 |
[Python] 위장 (0) | 2022.12.23 |
[Python] 전화번호 목록 (0) | 2022.12.23 |
[Python] 베스트앨범 (0) | 2022.12.22 |
Comments