Safe HaskellNone

Day05

Description

General - Good one. Simple recursion problem. Take a range of N and binary walksearch it (lower, upper) until you findhit the element.

N / L U

A path has the range and the steps in it. A boarding pass has two pathes: A row path and a column path.

Right?

Wrong!

If you think about it for a sec (or have somebody tell you), you will realize that the boarding pass can be read as a binary number and that the seatId is that binary number.

Part 1 - Find the max of all seats ids.

Part 2 - Find the one seat ids that is not on the plane.

Synopsis

Documentation

type SeatId = Int #

input :: String -> [SeatId] #

Read input file.

toBin :: Char -> Char #

Convert characters to binary digits.

toInt :: String -> Int #

Convert binary string to Int.

part1 :: [SeatId] -> Int #

Solve part1.

part2 :: [SeatId] -> Int #

Solve part2.