One of the most frequently asked coding interview questions on Array in companies like Google, Facebook, Amazon, LinkedIn, Microsoft, Uber, Apple, Adobe, bloomberg etc.
LeetCode : Subsets II
Problem URL - https://leetcode.com/problems/subsets...
Time complexity - O(N * 2^N)
Details - O(2^N) - To generate all subsets
O(N) - For copying them into output list.
Space Complexity - O(N * 2^N) to keep all the subsets of length N, since each of N elements could be present or absent.
where N is length of given input array.
Question :Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
Input: [1,2,2]
Output:
[
[2],
[1],
[1,2,2],
[2,2],
[1,2],
[]
]
Connect with me on LinkedIn at: / jayati-tiwari
#backtracking #subset #leetcode #coding #algorithms #facebook #bloomberg, #leetcode 90, #subsets-ii
On this page of the site you can watch the video online Leetcode 90. Subsets II [ Backtracking Algorithm + Code Explained] TC - O(N * 2^N) with a duration of hours minute second in good quality, which was uploaded by the user jayati tiwari 19 July 2020, share the link with friends and acquaintances, this video has already been watched 9,986 times on youtube and it was liked by 141 viewers. Enjoy your viewing!