This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 排列算法 P_{cnt}^{nums.len()} | |
| fn permutation(nums: Vec<i32>, cnt: usize) -> Vec<Vec<i32>> { | |
| fn helper(result: &mut Vec<Vec<i32>>, nums: &mut Vec<i32>, cnt: usize, idx: usize) { | |
| if idx == cnt { | |
| result.push(Vec::from(&nums[..idx])); | |
| return; | |
| } | |
| // 第idx个元素可选择的方法 | |
| for i in idx..nums.len() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace hello_csharp | |
| { | |
| class Program | |
| { | |
| class Node | |
| { | |
| public int val; | |
| public Node next; |
OlderNewer