8000 GitHub - aitzaz-ahmad/find-largest-sum: A subset problem solved using dynamic programming for a C++ test
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

aitzaz-ahmad/find-largest-sum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

find-largest-sum

A subset problem solved using dynamic programming for a C++ test

Problem Statement

Given an integer (T) and an integer set (I), find a subset (M) that the sum (S) of M's elements is the largest among all subsets of I. S <= T.

Signature of the interface: void find_largest_sum(int T, std::vector<int> I, vector<int>& M, int &S);

For example, if T: 11, I: {1, 2, 3, 4, 5, 6, 7}

Possible answers can be:

  • M: {5, 6}, S: 11
  • M: {4, 7}, S: 11
  • etc

NOTE: You only need to find one answer if there are multiple subsets meet the requirement. Please don’t use brute force way to solve this question. Your solution should be clean, clear, well commented, and thoroughly tested.

About

A subset problem solved using dynamic programming for a C++ test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0