mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 05:10:32 +01:00
Implement 2022 day 4
This commit is contained in:
@@ -92,3 +92,15 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the minimum and maximum of two unordered variables
|
||||
pub fn minmax<T>(a: T, b: T) -> (T, T)
|
||||
where
|
||||
T: PartialOrd,
|
||||
{
|
||||
if a < b {
|
||||
(a, b)
|
||||
} else {
|
||||
(b, a)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user