3rd and 2nd day
This commit is contained in:
17
01/part1.php
Normal file
17
01/part1.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
$increased = 0;
|
||||
$input = file('input', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$input = array_map('intval', $input);
|
||||
$previousReading = array_shift($input);
|
||||
|
||||
foreach ($input as $line) {
|
||||
if ($line > $previousReading) {
|
||||
$increased++;
|
||||
}
|
||||
$previousReading = $line;
|
||||
}
|
||||
echo $increased; //1553
|
||||
Reference in New Issue
Block a user