A non-recursive trick for subsets generation II

This problem requires finding out all the subsets of a small set S. For each subset S', you need to determine whether: Product(S') == Product(S - S') == Target Hence you need to find all S'. Subsets generation trick, as explained before on post I with the same title, does the trick here for an exponential-time solution, but since |S| is small (12), it works just fine. Bonus points for early termination whenever we reach a dead end. Code is down below, cheers, ACC. Partition Array into Two Equal Product Subsets - LeetCode You are given an integer array nums containing distinct positive integers and an integer target . Determine if you can partition nums into two non-empty disjoint subsets , with each element belonging to exactly one subset, such that the product of the elements in each subset is equal to target . Return true if such a partition exists and false otherwise. A subse...