hyunkookim 님의 블로그

  • 홈
  • 태그
  • 방명록

combination 2

[Backtracking: Combinations]: 39. Combination Sum ★

39. Combination Sum from typing import Listclass Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: res = [] def backtrack(start, comb, total): # Base case: 합이 target과 같으면 결과에 추가 if total == target: res.append(comb.copy()) return # 합이 target을 초과하면 더 이상 탐색하지 않음 if tot..

LeetCode/NeetCode 2024.12.27

[Backtracking: Combinations] 77. Combinations

77. Combinations https://youtu.be/q0s6m7AiM7o?si=im6vNN9SG6FK35Vs 풀이 과정문제 이해:n: 1부터 n까지의 숫자.k: 조합에 포함할 숫자의 개수.조합은 순서가 중요하지 않음.백트래킹 전략:숫자 1부터 n까지 반복하며 k개의 숫자를 선택.선택된 숫자는 조합에 추가.조합이 k개의 숫자를 만족하면 결과에 추가.선택한 숫자를 다시 되돌려가며 새로운 조합을 탐색.최적화:현재 숫자 iii를 선택한 뒤에는 i+1부터 탐색.중복된 조합 생성을 방지.class Solution: def combine(self, n: int, k: int) -> List[List[int]]: res = [] # 결과를 저장할 리스트 # 백트래킹 함수 정의 ..

LeetCode/NeetCode 2024.12.26
이전
1
다음
더보기
프로필사진

hyunkookim 님의 블로그

hyunkookim 님의 블로그 입니다.

  • 분류 전체보기 (457)
    • 개인 연구 (0)
    • job 인터뷰 (34)
      • 2025년 1분기 USA (2)
      • 코테(Amazon) 준비 (5)
      • 코테(Matroid) 준비 (27)
      • 코테 문제 (0)
    • 세팅 (7)
      • ubuntu (7)
    • 코드 형상 관리 (2)
      • git (2)
    • Coding Test (72)
      • 알고리즘 이론 (70)
      • Machine Learning (NeetCode) (2)
    • HackerRank (1)
      • 공통 (1)
    • CodeSignal (1)
      • 문제 은행 (1)
    • LeetCode (329)
      • 공통 (7)
      • Grind169 (60)
      • NeetCode (98)
      • Top Interview 150 (68)
      • LeetCode75 (34)
      • DP심화 (38)
      • 주제별 보충 (23)
      • [Weekly Contest] (0)
    • Deep Learning (4)
      • 3D 재구성 (0)
      • 장면 스타일 변환 (2)
      • 물체 인지 & 추적 (0)
      • 렌더링AI (2)
    • 일단 리스트업 (6)
      • 딥러닝 (2)
      • 코딩 테스트 (2)
      • 기타 (2)

Tag

Coding Test, dp, array / string, neetcode, 누적합, BST, dfs, 오블완, heap, BFS, LeetCode, 티스토리챌린지, Backtracking, 우선순위큐, tree, 슬라이딩윈도우, neetcode150, Two pointers, top150, leetcode75,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

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

방문자수Total

  • Today :
  • Yesterday :

Copyright © AXZ Corp. All rights reserved.

티스토리툴바