This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using StreamReader reader = new StreamReader(Console.OpenStandardInput()); | |
| Console.WriteLine(new Day1Part1(await reader.ReadToEndAsync()).Run()); | |
| public class Day1Part1 | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| using StreamReader reader = new StreamReader(Console.OpenStandardInput()); | |
| Console.WriteLine(new Day2Part1(await reader.ReadToEndAsync()).Run()); | |
| public static class StringExtension | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text.RegularExpressions; | |
| using StreamReader reader = new StreamReader(Console.OpenStandardInput()); | |
| Console.WriteLine(new Day2Part1(await reader.ReadToEndAsync()).Run()); | |
| public class Day2Part1 | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Linq; | |
| using StreamReader reader = new StreamReader(Console.OpenStandardInput()); | |
| Console.WriteLine(new Day1Part2(await reader.ReadToEndAsync()).Run()); | |
| public class Day1Part2 | |
| { | |
| private readonly int[] _data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Linq; | |
| using StreamReader reader = new StreamReader(Console.OpenStandardInput()); | |
| Console.WriteLine(new Day1Part1(await reader.ReadToEndAsync()).Run()); | |
| public class Day1Part1 | |
| { | |
| private readonly int[] _data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{env::args, error::Error, fs::File, io::Read}; | |
| enum MapEntity { | |
| Tree, | |
| Square | |
| } | |
| struct Map { | |
| pattern : Vec<Vec<MapEntity>>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{env::args, error::Error, fs::File, io::Read}; | |
| enum MapEntity { | |
| Tree, | |
| Square | |
| } | |
| struct Map { | |
| pattern : Vec<Vec<MapEntity>>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{env::args, error::Error, fs::File, ops::RangeInclusive, io::Read}; | |
| type PasswordPolicy = (RangeInclusive<u32>, char, String); | |
| fn load_input(path : &str) -> Result<Vec<PasswordPolicy>, std::io::Error> { | |
| let mut file = File::open(path)?; | |
| let mut data = String::new(); | |
| file.read_to_string(&mut data)?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{env::args, error::Error, fs::File, ops::RangeInclusive, io::Read}; | |
| type PasswordPolicy = (RangeInclusive<u32>, char, String); | |
| fn load_input(path : &str) -> Result<Vec<PasswordPolicy>, std::io::Error> { | |
| let mut file = File::open(path)?; | |
| let mut data = String::new(); | |
| file.read_to_string(&mut data)?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{error::Error, env::args, fs::File, io::Read}; | |
| fn load_input(path : &str) -> Result<Vec<i64>, std::io::Error> { | |
| let mut file = File::open(path)?; | |
| let mut data = String::new(); | |
| file.read_to_string(&mut data)?; | |
| let data : Vec<i64> = data.split('\n') | |
| .map(|line| line.parse::<i64>().unwrap_or(0)).collect(); |
NewerOlder