How to optimize my solution?

I recently ran into a problem that goes like this:

The student is given N number of questions and time T in general. Each question requires a different time to complete and different brands. The problem is to find the maximum marks that a student can get an attempt at some N questions inside T (assuming that a question has been taken, it should be completely completed, no partial attempt is allowed).

I tried to solve the problem by calculating all possible combinations of questions that take <= T seconds to complete, but soon found out it was inefficient for large data sets.

How can I optimize my solution? Is there an alternative solution available?

+4
source share
1 answer

It looks like a variant of the well-known Backpack problem.

+4
source

Source: https://habr.com/ru/post/1676719/