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


#1

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


#2

@Santhosh_Hyd Please refer https://codereview.stackexchange.com/questions/144172/subset-sum-problem-implementation

Hope it helps!


#3

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


#4

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.


#5

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


#6

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.


#7

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…


#8

@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 https://studio.uipath.com/v2017.1/docs/managing-activities-packages#section-adding-your-own-packages

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