akshit5638's blog

By akshit5638, history, 5 months ago, In English

we have an array of size n.each element of array is between 1 and 10.we are also given an integer k.We can divide array in atmost k subsets.After dividing, each element should belong to exactly one subset.We have to tell if it is possible to divide such that every subset sum<=10

constraints:

test case,t<=100

n<=1000

1<=a[i]<=10

1<=k<=100

example

t=1

n=12

2 1 2 5 4 3 6 1 1 9 3 2

k=4

than a valid division is

[9,1],[6,1,3],[5,2,3],[4,2,2,1]

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it