I have been given an array in unsorted order then I have to take two subsets out of it such that sum of elements of these subsets is very close to each other.
I know it’s a DP problem but donot know the approach. So Please help.
I have been given an array in unsorted order then I have to take two subsets out of it such that sum of elements of these subsets is very close to each other.
I know it’s a DP problem but donot know the approach. So Please help.
Hello @pd.pankajdahiya could you please share the question link so that i can hep you in the better way.
what i have understoof friom the above is i think you can do this with the two pointer approach as well.
but please share the exact question.
ok let me share the link
yes please share the link.
I have done this in n^3 using DP but constraints want it to be less than n^3. So how is that possible?
@pd.pankajdahiya try to watch ans see these videos.
https://www.google.com/search?q=watching+cpl+codechef+solution&sxsrf=ALeKk01pjt0y-LHD2CkxXb6cebBvqGUGOQ:1609847798023&source=lnms&tbm=vid&sa=X&ved=2ahUKEwikvJKx3oTuAhW1yzgGHWn7A3EQ_AUoAXoECAQQAw&biw=1126&bih=813&dpr=1.13
you will be able to understand through videos in the better way.
if you have any doubt you can ask here:
Happy Learning!!