# Knapsack Problems?

**URL:** <https://discuss.codechef.com/t/knapsack-problems/3795>\
**Category:** general\
**Tags:** dynamic-programming, knapsack\
**Created:** [December 3, 2013, 6:35pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795 "2013-12-03T18:35:40Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![slashed2\_gnr](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@slashed2\_gnr](https://discuss.codechef.com/u/slashed2_gnr)\
**Post date:** [December 3, 2013, 6:35pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/1 "2013-12-03T18:35:40Z")

</div>

What are your favourite knapsack problems? Please link them in the answer. I just learnt the algo and would like to get proficient in it. Thanks 😃

---

<div class="post-metadata">

**Author:** ![anand\_007](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@anand\_007](https://discuss.codechef.com/u/anand_007)\
**Post date:** [December 3, 2013, 6:53pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/2 "2013-12-03T18:53:04Z")

</div>

> **[SPOJ.com - Problem LKS](https://www.spoj.com/problems/LKS/)**
>
> ...

---

<div class="post-metadata">

**Author:** ![utsav\_deep](https://discuss.codechef.com/user_avatar/discuss.codechef.com/utsav_deep/32/9452_2.png) [@utsav\_deep](https://discuss.codechef.com/u/utsav_deep)\
**Post date:** [December 3, 2013, 11:46pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/3 "2013-12-03T23:46:23Z")

</div>

> **[SPOJ.com - Problem KNAPSACK](https://www.spoj.com/problems/KNAPSACK/)**
>
> ...

this qn itself says it is knapsack problem, u can get ac in first attempt in this qn… easy one

---

<div class="post-metadata">

**Author:** ![raj01104](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@raj01104](https://discuss.codechef.com/u/raj01104)\
**Post date:** [December 4, 2013, 1:46am UTC](https://discuss.codechef.com/t/knapsack-problems/3795/4 "2013-12-04T01:46:12Z")

</div>

> **[SPOJ.com - Problem HS08AKP](https://www.spoj.com/HSPLARCH/problems/HS08AKP/)**
>
> ...

nice problem of knapsack…🙂

---

<div class="post-metadata">

**Author:** ![infinitum](https://discuss.codechef.com/user_avatar/discuss.codechef.com/infinitum/32/1768_2.png) [@infinitum](https://discuss.codechef.com/u/infinitum)\
**Post date:** [December 9, 2013, 1:59pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/5 "2013-12-09T13:59:10Z")

</div>

Some of them below are good 🙂

> **[SPOJ.com - Problem SCUBADIV](https://www.spoj.com/problems/SCUBADIV/)**
>
> ...

> **[SPOJ.com - Problem PARTY](https://www.spoj.com/problems/PARTY/)**
>
> ...

> **[MARCHA1 Problem - CodeChef](https://www.codechef.com/problems/MARCHA1/)**
>
> Practice your programming skills with easy level problem on Data Structures.

> **[Problem - B - Codeforces](https://codeforces.com/contest/364/problem/B)**
>
> Codeforces. Programming competitions and contests, programming community

> **[Problem - 95E - Codeforces](https://codeforces.com/problemset/problem/95/E)**
>
> Codeforces. Programming competitions and contests, programming community

> **[Problem - 190A - Codeforces](http://www.codeforces.com/problemset/problem/190/A)**
>
> Codeforces. Programming competitions and contests, programming community

> **[Problem - 19B - Codeforces](https://codeforces.com/problemset/problem/19/B)**
>
> Codeforces. Programming competitions and contests, programming community

[http://www.spoj.pl/problems/KNAPSACK/](http://www.spoj.pl/problems/KNAPSACK/)

> **[TEAMSEL Problem - CodeChef](https://www.codechef.com/problems/TEAMSEL/)**
>
> Practice your programming skills with easy level problem on Dynamic Programming.

[http://code.google.com/codejam/contest/dashboard?c=90101#s=p2](http://code.google.com/codejam/contest/dashboard?c=90101#s=p2)

[http://community.topcoder.com/stat?c=problem\_statement&pm=11511&rd=14545](http://community.topcoder.com/stat?c=problem_statement&pm=11511&rd=14545)

[http://pclub.in/index.php/wpc-archives/16-kodefest-solutions/86-problem-d](http://pclub.in/index.php/wpc-archives/16-kodefest-solutions/86-problem-d)

> **[CodeChef: Practical coding for everyone](https://www.codechef.com/MARCH10/problems/N1)**
>
> Learn to code for free using our beginner friendly and interactive learning courses. Get all the practical skills required to excel at computer science. Start learning with CodeChef today and unlock your potential as a developer!

[http://www.spoj.pl/problems/PIGBANK/](http://www.spoj.pl/problems/PIGBANK/)

[http://www.spoj.pl/problems/GNYR09F/](http://www.spoj.pl/problems/GNYR09F/)

[http://www.spoj.pl/problems/THREECOL/](http://www.spoj.pl/problems/THREECOL/)

[http://www.spoj.pl/problems/SCUBADIV/](http://www.spoj.pl/problems/SCUBADIV/)

[http://code.google.com/codejam/contest/dashboard?c=1128486](http://code.google.com/codejam/contest/dashboard?c=1128486)

[http://www.spoj.pl/problems/AE1B/](http://www.spoj.pl/problems/AE1B/)

[http://www.spoj.pl/problems/ARRANGE/](http://www.spoj.pl/problems/ARRANGE/)

Will Add more to the List 🙂 if come across some Knapsack problems

---

<div class="post-metadata">

**Author:** ![garakchy](https://discuss.codechef.com/user_avatar/discuss.codechef.com/garakchy/32/359366_2.png) [@garakchy](https://discuss.codechef.com/u/garakchy)\
**Post date:** [December 10, 2013, 4:14am UTC](https://discuss.codechef.com/t/knapsack-problems/3795/6 "2013-12-10T04:14:41Z")

</div>

what Knapsack itself. i have been looking around on the net, but could not understand the theory yet. i am a nwebie.  
thnx

---

<div class="post-metadata">

**Author:** ![pale\_rider](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@pale\_rider](https://discuss.codechef.com/u/pale_rider)\
**Post date:** [January 16, 2014, 3:57pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/7 "2014-01-16T15:57:32Z")

</div>

This is a pretty good simple knapsack problem: [PPTEST Problem - CodeChef](http://www.codechef.com/problems/PPTEST/)

Another slightly tougher knapsack problem: [SPOJ.com - Problem BACKPACK](http://www.spoj.com/problems/BACKPACK/)

---

<div class="post-metadata">

**Author:** ![j2j2\_4](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@j2j2\_4](https://discuss.codechef.com/u/j2j2_4)\
**Post date:** [December 9, 2013, 12:16pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/8 "2013-12-09T12:16:27Z")

</div>

it really helped

---

<div class="post-metadata">

**Author:** ![prasu\_newbie](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@prasu\_newbie](https://discuss.codechef.com/u/prasu_newbie)\
**Post date:** [December 9, 2013, 7:05pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/9 "2013-12-09T19:05:59Z")

</div>

Nice Collection 🙂

---

<div class="post-metadata">

**Author:** ![prasu\_newbie](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@prasu\_newbie](https://discuss.codechef.com/u/prasu_newbie)\
**Post date:** [December 9, 2013, 7:06pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/10 "2013-12-09T19:06:32Z")

</div>

perfect problem to start with knapsack thanq 🙂

---

<div class="post-metadata">

**Author:** ![ffida2000](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@ffida2000](https://discuss.codechef.com/u/ffida2000)\
**Post date:** [December 9, 2013, 7:45pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/11 "2013-12-09T19:45:46Z")

</div>

nice one 🙂

---

<div class="post-metadata">

**Author:** ![garakchy](https://discuss.codechef.com/user_avatar/discuss.codechef.com/garakchy/32/359366_2.png) [@garakchy](https://discuss.codechef.com/u/garakchy)\
**Post date:** [December 10, 2013, 7:35am UTC](https://discuss.codechef.com/t/knapsack-problems/3795/12 "2013-12-10T07:35:54Z")

</div>

i think i found a helpful info here: [http://www.programminglogic.com/knapsack-problem-dynamic-programming-algorithm/](http://www.programminglogic.com/knapsack-problem-dynamic-programming-algorithm/)

---

<div class="post-metadata">

**Author:** ![sp1rs](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@sp1rs](https://discuss.codechef.com/u/sp1rs)\
**Post date:** [January 16, 2014, 4:16pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/13 "2014-01-16T16:16:50Z")

</div>

Solve this [SPOJ.com - Problem PARTY](http://www.spoj.com/problems/PARTY/)  
Good way to start DP and knapsack type problem

---

<div class="post-metadata">

**Author:** ![charizard](https://discuss.codechef.com/user_avatar/discuss.codechef.com/charizard/32/1060_2.png) [@charizard](https://discuss.codechef.com/u/charizard)\
**Post date:** [January 16, 2014, 6:19pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/14 "2014-01-16T18:19:28Z")

</div>

Are you sure each of the above problems is an application of knapsack? I have solved some of them and i don’t think so. For example-

1. MIXTURES - Matrix Chain Multiplication
2. AGGRCOW - Binary search
3. STAMPS, BAISED - Adhoc

---

<div class="post-metadata">

**Author:** ![pale\_rider](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@pale\_rider](https://discuss.codechef.com/u/pale_rider)\
**Post date:** [January 18, 2014, 4:58pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/15 "2014-01-18T16:58:54Z")

</div>

I don’t think MINUS on SPOJ is knapsack either.

---

<div class="post-metadata">

**Author:** ![charizard](https://discuss.codechef.com/user_avatar/discuss.codechef.com/charizard/32/1060_2.png) [@charizard](https://discuss.codechef.com/u/charizard)\
**Post date:** [January 19, 2014, 9:21pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/16 "2014-01-19T21:21:49Z")

</div>

Wow!! Instead of replying to our queries, you just edited your answer and made aur questions look stupid. Now what will you do if i say that the problem AE1B is also adhoc ?

---

<div class="post-metadata">

**Author:** ![akkistar](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@akkistar](https://discuss.codechef.com/u/akkistar)\
**Post date:** [January 21, 2014, 7:52pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/17 "2014-01-21T19:52:34Z")

</div>

really nice one

---

<div class="post-metadata">

**Author:** ![paras885](https://discuss.codechef.com/user_avatar/discuss.codechef.com/paras885/32/21_2.png) [@paras885](https://discuss.codechef.com/u/paras885)\
**Post date:** [October 1, 2014, 4:45pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/18 "2014-10-01T16:45:35Z")

</div>

pale\_rider plz look problem carefully then surely u will understand that MINUS on spoj is knapsack 😉 😛 infinitum really nice collection 😃

---

<div class="post-metadata">

**Author:** ![adarsh000321](https://discuss.codechef.com/user_avatar/discuss.codechef.com/adarsh000321/32/35732_2.png) [@adarsh000321](https://discuss.codechef.com/u/adarsh000321)\
**Post date:** [August 3, 2019, 5:05pm UTC](https://discuss.codechef.com/t/knapsack-problems/3795/19 "2019-08-03T17:05:35Z")

</div>

> [@Printing selected items in space optimized 0/1 Knapsack](https://discuss.codechef.com/t/printing-selected-items-in-space-optimized-0-1-knapsack/33255):
>
> In this spoj problem [SPOJ.com - Problem HS08AKP](https://www.spoj.com/HSPLARCH/problems/HS08AKP/) constraints are bigger i.e., we cannot use 2D Knapsack so how else can we print the solutions in space optimized knapsack? Help would be greatly appreciated… slight_smile
