Array-Strings

Array DSA problems in swift.

Return all possible subset from an array

[Question]: Given an integer array that may contain duplicates, find all possible subsets (the power set). No duplicates allowed in answer. Solution in any order allowed. Input: nums = [1,2,3] Output: [1,2,3] [1,2] [1,3] [1] [2,3] [2] [3] [] Approach #2: Using Bitwise OperatorQuestion: Power Set: Print all the possible subsequences of the String To check …

Return all possible subset from an array Read More »

How to find duplicates in Array?

[Question] In a given array return true if array have duplicate elements . For example 1 :[1,2,3,1] = True example 1 :[1,2,3,] = False So here we have used Dictionary which is Hashable which contains only unique keys hence we can find duplicates elements in swift.