Knapsack

You have a backpack that can carry a maximum weight of C. You will also be given a set of items, the…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Hi there, Can someone assist me with this problem?

I’ve submitted my final solution at https://toph.co/s/1130765.

While I attempted to solve it using a novel approach, I encountered an issue where my solution fails the 4th test case despite passing all the test cases I could think of.

I was wondering if @hjr265 has any thoughts about revealing the test cases?
It would be immensely helpful for me.

Thank you all.

1 Like

@Nusab19 The decision about revealing test cases still stands. Test cases will be viewable soon in sha Allah.

But some other work had to be prioritized to address a few urgent requests/requirements.

I checked your submission. Here’s the input for the fourth test case:

100 1000
84 85
3 37
82 26
76 31
60 46
96 62
2 69
58 6
78 31
48 54
56 93
97 83
58 92
79 8
26 14
61 76
64 96
23 87
32 41
86 78
84 2
8 27
37 74
77 36
4 54
17 64
98 26
37 36
89 32
88 26
30 81
67 67
97 100
20 37
75 35
61 37
47 17
46 82
77 57
34 92
6 96
92 96
57 52
98 16
90 21
2 43
31 80
90 56
86 39
2 31
66 50
69 63
76 10
69 76
1 58
95 72
31 21
32 14
52 90
77 63
72 51
59 49
99 69
92 65
97 26
92 62
14 17
28 11
62 6
30 99
68 90
53 45
2 85
27 46
47 85
41 97
29 48
3 52
65 99
64 39
76 6
18 48
19 67
41 36
54 75
44 81
92 11
4 47
69 91
58 8
22 54
41 33
54 44
14 98
58 13
78 26
39 50
83 14
69 12
100 52
1 Like