fn rotate_distinct<'a, T>(a: &'a mut [T], b: &'a mut [T])Examples found in repository?
crates/competitive/src/algorithm/combinations.rs (line 350)
337fn next_combination_inner<T>(a: &mut [T], b: &mut [T]) -> bool
338where
339 T: Ord,
340{
341 if a.is_empty() || b.is_empty() {
342 return false;
343 }
344 let mut target = a.len() - 1;
345 let last_elem = b.last().unwrap();
346 while target > 0 && &a[target] >= last_elem {
347 target -= 1;
348 }
349 if target == 0 && &a[target] >= last_elem {
350 rotate_distinct(a, b);
351 return false;
352 }
353 let mut next = 0;
354 while a[target] >= b[next] {
355 next += 1;
356 }
357 swap(&mut a[target], &mut b[next]);
358 rotate_distinct(&mut a[target + 1..], &mut b[next + 1..]);
359 true
360}