File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1167,6 +1167,21 @@ function findAllSubsetsoOfGivenSet(arr)
11671167 return result
11681168}
11691169console.log(findAllSubsetsoOfGivenSet([8,9]));
1170+ --------------------------------------------------------
1171+ function findAllSubsets(arr){
1172+ var result = []
1173+ for(var item of arr){
1174+ let tempSub = [...result]
1175+ for(var curr of tempSub){
1176+ result.push([...curr, item])
1177+ }
1178+ result.push([item])
1179+ }
1180+ result.push([])
1181+ return result
1182+ }
1183+
1184+ console.log(findAllSubsets([1,2]))
11701185================================================================================================================================================================================
11711186Code 82: To find the maximum repetation of the character in a string
11721187 function maxRepeating(str)
You can’t perform that action at this time.
0 commit comments