day2/1: optimized

This commit is contained in:
Ishan Jain 2023-12-02 16:30:02 +05:30
parent 77fa1331b2
commit 199451f692
Signed by: ishan
GPG Key ID: 0506DB2A1CC75C27

View File

@ -25,18 +25,21 @@ fn process(data: &[u8]) -> u64 {
line = &l[3..]; line = &l[3..];
if num > 12 { if num > 12 {
possible = false; possible = false;
break;
} }
} }
[b'g', ..] => { [b'g', ..] => {
line = &l[5..]; line = &l[5..];
if num > 13 { if num > 13 {
possible = false; possible = false;
break;
} }
} }
[b'b', ..] => { [b'b', ..] => {
line = &l[4..]; line = &l[4..];
if num > 14 { if num > 14 {
possible = false; possible = false;
break;
} }
} }
[b' ', ..] => line = l, [b' ', ..] => line = l,