Subsets (bitmask enumeration) (LeetCode 78)The problem You get an array of distinct integers. Return every possible subset…