pub fn decode(n: usize, k: usize) -> Vec<usize>Expand description
Returns the combination of a value.
The returned combination can be encoded with encode to get back n.
let n = 5;
let k = 3;
let xs = decode(n, k);
assert_eq!(encode(&xs), 5);See decode_mut for a version that writes the combination to a provided slice.
§Panics
Panics in debug mode if n > 0 && k == 0.
§Examples
assert_eq!(decode(0, 3), &[0, 1, 2]);
assert_eq!(decode(1, 3), &[0, 1, 3]);
assert_eq!(decode(2, 3), &[0, 2, 3]);