From fafa0b777ea80b4400c8ad3470b991df92dbc8eb Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Tue, 4 Dec 2018 21:11:06 -0500 Subject: Solve day 4 part 2 --- 2018/day04.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '2018') diff --git a/2018/day04.c b/2018/day04.c index 5d2939f..78506ab 100644 --- a/2018/day04.c +++ b/2018/day04.c @@ -42,4 +42,14 @@ int main() { maxMin = m; } printf("%u\n", maxID * maxMin); + maxID = maxMin = maxSleep = 0; + for (uint i = 0; i < Len; ++i) { + for (uint m = 0; m < 60; ++m) { + if (guards[i][m] < maxSleep) continue; + maxSleep = guards[i][m]; + maxMin = m; + maxID = i; + } + } + printf("%u\n", maxID * maxMin); } -- cgit 1.4.1