경쟁 프로그래밍쉬움

최소 코인 수

'최소 코인 수' 문제에 대한 자세한 가이드 및 Python 구현입니다.

문제 설명

쉬움

주어진 동전 명칭 coins을 사용하여 목표 변경 V을 만드는 데 필요한 최소 동전 수를 반환하는 함수 min_coins(coins, V)을 작성하세요. 변경이 불가능한 경우 -1을 반환합니다.

제약
  • 1 <= len(coins) <= 100
  • 1 <= V <= 10000
  • 1 <= coins[i] <= 1000

Example 1
Input
min_coins([9, 6, 5, 1], 11)
Output
2
Explanation

We can make 11 using coins 6 and 5 (2 coins).

Example 2
Input
min_coins([5, 10], 7)
Output
-1
Explanation

We cannot make change for 7 using only coins of value 5 and 10.

Need a Hint?
세트나 힙과 같은 동적 프로그래밍 관련 데이터 구조를 사용해 보세요.
Edge Cases to Watch
  • 빈 입력 구조
  • 단일 요소 입력
  • 큰 수치 범위

해결할 준비가 되셨나요?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

편집기에서 열기
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

권장 Python 리소스

관련 대화형 튜토리얼, 치트 시트, 코드 비교를 통해 지식을 확장하세요.