mirror of
https://github.com/chylex/Advent-of-Code.git
synced 2025-05-25 00:34:06 +02:00
Add 2021 - Day 1 - Part 1
This commit is contained in:
parent
840577f13b
commit
2f09ca9982
11
.idea/runConfigurations/2021___Day_01.xml
Normal file
11
.idea/runConfigurations/2021___Day_01.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="2021 - Day 01" type="JetRunConfigurationType">
|
||||
<option name="MAIN_CLASS_NAME" value="MainKt" />
|
||||
<module name="Advent_of_Code.2021-01" />
|
||||
<shortenClasspath name="NONE" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/2021/01" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
2000
2021/01/input/1.txt
Normal file
2000
2021/01/input/1.txt
Normal file
File diff suppressed because it is too large
Load Diff
7
2021/01/main.kt
Normal file
7
2021/01/main.kt
Normal file
@ -0,0 +1,7 @@
|
||||
import java.io.File
|
||||
|
||||
fun main() {
|
||||
val lines = File("input/1.txt").readLines().map(String::toInt)
|
||||
val totalIncreases = lines.windowed(2).count { it[1] > it[0] }
|
||||
println("Total Increases: $totalIncreases")
|
||||
}
|
Loading…
Reference in New Issue
Block a user