Some bitcoin transactions (especially CoinJoin transactions) include two or more sub-transactions. for example, consider a transaction with Inputs = [2, 3, 4] and Outputs = [4, 5].
In this example, we have two sub-transactions: (2+3 = 5) & (4 = 4) so it is a kind of subset sum problem but for 2 sets, inputs and outputs.
I want to know how to solve subset sum for this specific problem. I know it needs a brute force, but don't how to optimize it? I don't know how to run a brute force either.