[Leetcode 90] - Subsets II
Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. 중복된 숫자가 있는 배열이 주어졌을때 가능한 하위 집합을 찾는 문제 리턴하는 배열에는 중복된 집합을 포함시킬수 없다 https://leetcode.com/problems/subsets-ii/description/ Example 1: Input: nums = [1,2,2] Output: [[],[1],[1,2],[1,2,2],[2],[2,2]] Example 2: Input..
2024. 4. 12.
[Leetcode 46] - Permutations w/ Python
Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. 배열이 주어졌을때 순열을 찾는 문제 https://leetcode.com/problems/permutations/description/ Example 1: Input: nums = [1,2,3] Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] Example 2: Input: nums = [0,1] Output: [[0,1],[1,0]] Example 3: Input: nums = [1] Output: [[1]] 답은 매우 쉽죠? class..
2024. 4. 12.
[Leetcode 78] - Subsets w/ Python
Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. 숫자 배열이 주어졌을때 가능한 모든 하위 집합을 리턴 중복된 집합을 배제해야된다 https://leetcode.com/problems/subsets/description/ Example 1: Input: nums = [1,2,3] Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] Example 2: Input: nums = [0] Output: [..
2024. 4. 12.