I came across a problem in which I had to find a subset of values which gave me sum N ( N~1e12 ). The value array was hard-coded (by me) and now I am struggling to find a solution to this. The size of array is only 52, but I didn't know how to store boolean values for 'possible' array. I tried bitset, but the size of N is too large.
Could anyone suggest some method?
You can solve it using meet-in-the-middle technique