MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / permute

Method permute

46. Permutations/src/main.rs:8–15  ·  view source on GitHub ↗
(nums: Vec<i32>)

Source from the content-addressed store, hash-verified

6
7impl 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 {

Callers

nothing calls this directly

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected