mirror of
https://github.com/paradizelost/AdventOfCode2020.git
synced 2024-11-25 02:44:45 -06:00
18 lines
511 B
PowerShell
18 lines
511 B
PowerShell
$myinput = get-content .\aocd10input.txt
|
|
$myinput = $myinput | %{[int]$_} | Sort-Object
|
|
$adapterjoltage = 0
|
|
$differences=@{}
|
|
$differences[3]=1
|
|
$endjolts=$myinput[-1]+3
|
|
#write-host $endjolts
|
|
for($i=0; $i -lt $myinput.count ; $i++){
|
|
$difference = $myinput[$i] - $adapterjoltage
|
|
write-host "Diff: $difference"
|
|
if($differences[$difference]){
|
|
$differences[$difference]++
|
|
} else {
|
|
$differences[$difference]=1
|
|
}
|
|
$adapterjoltage = $myinput[$i]
|
|
}
|
|
$differences[3] * $differences[1] |