Skip to content

Commit

Permalink
use T
Browse files Browse the repository at this point in the history
  • Loading branch information
uesugi6111 committed Dec 10, 2023
1 parent 8d72773 commit edd197b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/algorithm/inversion_number.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! 転倒数
pub fn inversion_number(array: &[i64]) -> i64 {
pub fn inversion_number<T: Copy + PartialOrd>(array: &[T]) -> i64 {
count_merge(&mut array.to_vec(), 0..array.len())
}
fn count_merge(array: &mut Vec<i64>, range: std::ops::Range<usize>) -> i64 {
fn count_merge<T: Copy + PartialOrd>(array: &mut Vec<T>, range: std::ops::Range<usize>) -> i64 {
let length = range.len() as i64;
if length <= 1 {
return 0;
Expand Down

0 comments on commit edd197b

Please sign in to comment.