Subsets 2 (Leetcode 90) - Medium (Hindi) | Facebook Interview Question

preview_player
Показать описание
✅ Useful Links

Subsets 2 (Leetcode 90)

Music Credit
Track: Julius Dreisig & Zeus X Crona - Invisible [NCS Release]
Music provided by NoCopyrightSounds.

Track: Axollo - Silence (ft. Josh Bogert) [NCS Release]
Music provided by NoCopyrightSounds.
Рекомендации по теме
Комментарии
Автор

best series encountered so far without using unneccessary logics - beginner friendly !!

ksciencebuddy
Автор

I remember I was struggling with the concept, your videos aided me a lot. Cheers....!

abhinavkumar
Автор

Sir I have seriously struggled a lot with this stuff, thank you so much!

sanjana
Автор

agr if we will continue when 2 comes again then how [1, 2, 2] will be formed?

khushichouksey
Автор

isme set vala trika thoda sa bta dete to sahi rehta

theuntoldtree
Автор

What will be the time and space complexity of this solution?

adarshupadhyay
Автор

class Solution:
def subsetsWithDup(self, nums):
index=0
current=[]
residual=[]
nums.sort()
return (self.subset(index, nums, current, residual))

def subset(self, index, nums, current, residual):
current.sort()
if current not in residual:
temp=copy.deepcopy(current)
residual.append(temp)

for i in range(index, len(nums)):
current.append(nums[i])
self.subset(i+1, nums, current, residual)
current.pop(len(current)-1)
return residual


** the filter logic is little complex to understand
simple :
sort the array b4 passing : nums.sort()
before pushing to residual sort and check check if it is already present : current.sort()

sudiptodas
Автор

sir missed one major point, saying sort the array

theuntoldtree
Автор

Bhaiya bina back tracking k nhi ho sakta kya?

PROTECHRAHUL
Автор

why it is i>start i cannot understand

sanskartayal
visit shbcf.ru