Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Time complexity is still O(len(ls)!) which is the same as the time complexity for the computing combinations. Might have a better constant prefactor.
I don't think there is a DP way of solving this problem which usually has a time complexity of O(polynomial(len(ls))). I tried for a long time and couldn't get anywhere. The issue is that the sum is bounded by t. The familiar knapsack problem only asks that we maximize without bounds.
nevermind, I just scrolled down and saw somebody submitted this already. It was fun to learn about regex to come up with this on my own though.
This comment is hidden because it contains spoiler information about the solution