| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 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 | 
													Tags
													
											
												
												- English
- 10분
- 잡생각
- 쓰릴오브파이트
- leetcode
- 미드시청
- Problem Solving
- 스탭퍼
- 매일
- 운동
- 리얼 클래스
- FIT XR
- 읽기
- Daily Challenge
- 파비최
- 사이드
- realclass
- 월간
- 영어공부
- 화상영어
- 괜찮음
- 링피트
- 30분
- 3줄정리
- 영어원서읽기
- Writing
- 프로젝트
- 개발자
- 뭐든
- 만화도
													Archives
													
											
												
												- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/combination-sum-iv/
Combination Sum IV - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
DP를 이용한 간단한 문제
class Solution:
    def combinationSum4(self, nums: List[int], target: int) -> int:
        dp = [0 for _ in range(target+1)]
        dp[0] = 1
        
        for i in range(1, target+1):
            for num in nums:
                num_before = i - num
                if num_before >= 0:
                    dp[i] += dp[num_before]
        return dp[target]반응형
    
    
    
  'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2022.08.07 | 
|---|---|
| Today's Challenge (0) | 2022.08.06 | 
| Today's Challenge (0) | 2022.08.04 | 
| Today's Challenge (0) | 2022.08.03 | 
| Today's Challenge (0) | 2022.08.02 | 
			  Comments