Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
uesugi6111 committed Dec 2, 2023
1 parent ed450df commit 2c0507e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/math/permutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ where
self.init = true;
return Some(self.p.clone());
}
let Some(i) = (0..&self.p.len() - 1).rfind(|&i| self.p[i] < self.p[i + 1]) else { return None; };
let Some(i) = (0..&self.p.len() - 1).rfind(|&i| self.p[i] < self.p[i + 1]) else {
return None;
};
let j = self.p.iter().rposition(|x| x > &self.p[i]).unwrap();
self.p.swap(i, j);
self.p[i + 1..].reverse();
Expand Down

0 comments on commit 2c0507e

Please sign in to comment.