LeetCode: 47번 (Permutations II) [JAVA]
문제 링크 https://leetcode.com/problems/permutations-ii/ Permutations II - LeetCode Permutations II - Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1,1,2] Output: [[1,1,2], [1,2,1], [2,1,1]] Example 2: Input: nums = [1,2,3] Output: [[ leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 순열 순서 저장용 arr 생성 (모든 원소 -1로 초..
LeetCode: 46번 (Permutations) [JAVA]
문제 링크 https://leetcode.com/problems/permutations/ Permutations - LeetCode Permutations - Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. 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 leetcode.com 풀이 전체적인 풀이 과정은 다음과 같다. 순열 순서 저장용 arr 생성 (모든 원소 -1로 초기화) 순..