Cleanup
This commit is contained in:
parent
b95f9d2a48
commit
7a2db9ae56
|
@ -2,13 +2,9 @@ mod common;
|
|||
|
||||
use std::collections::HashSet;
|
||||
|
||||
type Input = String;
|
||||
type Input = str;
|
||||
type Result = usize;
|
||||
|
||||
fn processed_input(input: &str) -> Input {
|
||||
input.to_owned()
|
||||
}
|
||||
|
||||
fn part1(input: &Input) -> Result {
|
||||
let c: Vec<char> = input.chars().collect();
|
||||
for i in 3.. {
|
||||
|
@ -28,8 +24,6 @@ fn part1(input: &Input) -> Result {
|
|||
|
||||
fn part2(input: &Input) -> Result {
|
||||
let c: Vec<char> = input.chars().collect();
|
||||
println!("{} {}", 88, c.len());
|
||||
|
||||
for i in 13..c.len() {
|
||||
let mut s: HashSet<char> = HashSet::new();
|
||||
for j in i - 13..=i {
|
||||
|
@ -45,16 +39,9 @@ fn part2(input: &Input) -> Result {
|
|||
|
||||
fn main() {
|
||||
let input_text = common::day_input(6);
|
||||
let input = processed_input(&input_text);
|
||||
let input2 = processed_input(&input_text);
|
||||
common::show_answers(&part1(&input), &part2(&input2))
|
||||
// common::show_both_answers(&both_parts(&input))
|
||||
common::show_answers(&part1(&input_text), &part2(&input_text))
|
||||
}
|
||||
|
||||
// fn both_parts(input: &Input) -> (Result, Result) {
|
||||
// (0, 0)
|
||||
// }
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -63,10 +50,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test() {
|
||||
// let input = processed_input(TEST_INPUT);
|
||||
// assert_eq!(part1(&input), 7);
|
||||
let input = processed_input(TEST_INPUT);
|
||||
assert_eq!(part2(&input), 19);
|
||||
// assert_eq!(both_parts(&input), (0, 0));
|
||||
let input = TEST_INPUT;
|
||||
assert_eq!(part1(input), 7);
|
||||
assert_eq!(part2(input), 19);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue