• Image placeholder
  • 홈 페이지
  • 블로그 센터
  • 범주
Image placeholder

Knapsack

[Algorithm Champions] Week 4, No.4

capacity를 넘지 않으면서 더한 값은 최대일 때의 무게와 index를 찾는 문제이다. dp table을 만들면서 최대 무게를 찾는다. - [curVal, curWeight], cap curWeight가 cap보다 작거나 같을 때 1.1 cap에서 curWeight를 뺀다. -> cap -= curWeight (두 번째 cap) 이전 item과 cap(위에서 curWeight한 것)일 때...

알고리즘KnapsackKnapsack

© 2022 intrepidgeeks.com

Privacy Policy Contact US Sitemap
🍪 This website uses cookies to ensure you get the best experience on our website. Learn more