Given an array x of length n, and a set of arrays S such that each array in S has length n, find a maximal size set of arrays G in S such that for all 1 <= i <= n, x[i] >= sum(g[i]) for all g in G.
e.x. if x = [3, 3] and S = {[3, 0], [1, 1], [2, 1]}, then the best set is {[1, 1], [2, 1]} because the sum is [3, 2] and the element at each index is less than the corresponding element in x. {[3, 0], [1, 1]} does not work because the sum is [4, 1], and 4 > x[0] = 3.
Is there an algorithm whose run time is polynomial in n and |S|?
Background/Context: This question arose from a question on scrabble. Given a list of tiles, and a word, can you form the word with the tiles? I extended it to given a list of tiles, and a list of words, what is the maximum number of words in the list that can be formed from the tiles?
n.