남남이루의 고군분투 🌳

  • 태그
  • 방명록
  • GIT Hub

Deque 2

[queue] 프로그래머스 lv2. 두큐합 같게 만들기 (feat. deque의 주요 메서드)

아직 잘 모르겠는 문제, 외우고 쳐보는 것도 잘 안된다. 참고한 후, 답안 from collections import deque def solution(queue1, queue2): answer = 0 mid = sum(queue1) + sum(queue2) if mid % 2 != 0: return -1 tot //= 2 q1 = deque(queue1) q2 = deque(queue2) sum1 = sum(queue1) sum2 = sum(queue2) while q1 and q2: if sum1 > mid: tmp = q1.popleft() sum1 -= tmp sum2 += tmp elif sum1 < mid: tmp = q2.popleft() q1.append(tmp) sum1 += tmp su..

⚡️algorithm/accepted 2022.09.08

[DFS, BFS] 백준 1260. DFS와 BFS

깊이 우선 탐색(DFS)과 너비 우선 탐색(BFS) BFS 코드의 프레임 특징 from collections import deque ... def BFS(v): q = deque() q.append(v) while q: p = q.popleft() print(p) from collections import deque import sys sys.stdin = open('C:\\tech\\backjoon\\graph\\input3.txt','r') input = sys.stdin.readline res = [] def DFS(node): visit1[node] = 1 line = graph[node] for i in range(1,n+1): if line[i] == 1 and visit1[i] == 0: i..

⚡️algorithm 2022.05.02
1
더보기
프로필사진

구구절절 개발블로그

  • Category (179)
    • Project (5)
    • Programming (36)
      • 💥 뽀개기 (1)
      • ☕ JavaScript (5)
      • 🧞‍♂️ React, TypeScript (6)
      • 🐍 Python (6)
      • 📚 Book Study (6)
      • 🌐 Web (3)
      • Tips (5)
    • ⚡️algorithm (98)
      • step-up ++ (6)
      • accepted (14)
      • master (1)
    • News (5)
      • Frontend (5)
      • Backend (0)
    • log ✎⁾⁾⁾ (30)
      • comming soon (0)
      • career (7)

Tag

typescript, 파이썬, DFS, 이분탐색, BFS, clean code, Dictionary, 책스터디, 부스트캠프, Git, 알고리즘, 그리디, Set, 프로그래머스, DP, 더오래하면돼, combinations, 그래프, 클린코드, ADHD,

Archives

«   2025/05   »
일 월 화 수 목 금 토
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

최근댓글

방문자수Total

  • Today :
  • Yesterday :
글쓰기 관리자 GitHub

Copyright © Kakao Corp. All rights reserved.

  • Github

티스토리툴바