How to find the sum of Array subsets equal to Input value

Hi,

If i gave input sum as 5 and array as {1,2,3,4,5}, i have to find the list of subsets for which their sum is equal to Input Sum

Now for the above Array, i have to get : {1,4},{2,3},{5}

TIA

1 Like

@Santhosh_Hyd Please refer c# - Subset sum problem implementation - Code Review Stack Exchange

Hope it helps!

can you send me the uipath file, its showing errors and am not able to upload the screenshots…

Hi @Santhosh_Hyd,

I dont have the file ready now. If you could give me some time. I will send you the file.
The other option is copy the content in the link shared to a .cs file and create a custom activity.

1 Like

thanks, but i would like to try with uipath file only, can you send me that file whenever you can(in uipath only)…that would be really helpful

Thanks

Hi @Santhosh_Hyd,

I have created a nuget package. Implementing this directly in UiPath involves multiple loops and hence it will be clumsy and time taking.
SubsetOfArray.Activities.1.0.1.nupkg (4.3 KB)

Please let me know if this works for you.

i tired to access this code, but i am not able to bcoz i am not able to see nuget packages in my uipath studio, i tried every option but couldnt…

@Santhosh_Hyd

Copy the file inside the nuget package i shared in the Packages folder of your UiPath Studio install location (C:\Program Files (x86)\UiPath\Studio\Packages)
Follow the steps specified in Managing Activities Packages

once the package is added, restart the studio to see the activity in Activity pane.

1 Like

Dear Madhavi,

I’ve tried your activity but i always get an error. Could you please advise what i should do to solve this problem. Thanks a lot!