(nums: Vec<i32>)
| 6 | |
| 7 | impl Solution { |
| 8 | pub fn permute(nums: Vec<i32>) -> Vec<Vec<i32>> { |
| 9 | let mut res = vec![vec![]]; |
| 10 | for &i in nums.iter() { |
| 11 | Self::permute_add(&mut res, i); |
| 12 | } |
| 13 | res.sort(); |
| 14 | res |
| 15 | } |
| 16 | |
| 17 | pub fn permute_add(permutation: &mut Vec<Vec<i32>>, elem: i32) { |
| 18 | if permutation.len() == 0 { |