Add exercise 212, 258, fix clippy warnings

This commit is contained in:
Emelie Graven 2022-04-03 12:28:12 +02:00
parent c5aa3d4abf
commit 6ff23340af
Signed by: emelie
GPG key ID: C11123726DBB55A1
6 changed files with 260 additions and 4 deletions

View file

@ -98,6 +98,8 @@ Here's the first pass through the algorithm using the original example:
At this point you would start over at step 1 with the sequence `[5, 4, 4, 2, 1, 1, 1]`. After your second pass through the algorithm, your sequence will be `[3, 3, 1, 0, 0, 1]`, so start back at step 1 with this sequence. After your third pass you'll have `[2, 0, 0]`. On your fourth pass, you'll stop at step 5, because you'll have `N = 2` and an empty sequence (`[]`), and 2 > 0, so you will return false.
*/
#![allow(dead_code)]
#![allow(unused)]
fn main() {}
@ -122,7 +124,7 @@ fn warmup_4(i: i32, mut set: Vec<i32>) -> Vec<i32> {
fn e_378(mut set: Vec<i32>) -> bool {
loop {
set = warmup_1(set);
if set.len() == 0 {
if set.is_empty() {
break true;
}
set = warmup_2(set);