# Tag Info

1

Function design The function itself is well named. The main problem is that it is specific to the ABC, while that is just one alphabet. I would make it generic and have a class accept an alphabet which then can be used anywhere. This makes it more valuable for reuse. Similarly, it handles upper and lowercase, while that is not clearly communicated. This is ...

1

As already stated, not sure why you're returning vectors; the linked question asks for a number. And with that, you can use big-integers with simple calculations; some already do num-combin and num-perm efficiently behind the scenes. Ignoring the algorithm though (since that seems to be your intent), you're passing ownership of values that you're not ...

0

You can match on a tuple, which flattens everything: impl PartialOrd for Number { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { match (self, other) { (Number::U8(x), Number::U8(y)) => (*x).partial_cmp(y), (Number::U8(x), Number::I8(y)) => (*x as i16).partial_cmp(&(*y as i16)), ...

2

let consonant = Vec::from([ 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'б', 'в', 'г', 'д', 'ж', 'з', 'й', 'к', 'л', 'м', 'н', 'п', 'р', 'с', 'т', 'ф', 'х', 'ц', 'ч', 'ш', 'щ' ]); An alternative would be: fn is_consonant(character: char) -> bool { matches!(character, 'b' | 'c' | ....

Top 50 recent answers are included