// Instead of zones or groups, this airline uses binary space partitioning to seat people.
// A seat might be specified like FBFBBFFRLR, where F means "front", B means "back", L means "left", and R means "right".
// Every seat also has a unique seat ID: multiply the row by 8, then add the column.
// Here are some other boarding passes:
// BFFFBBFRRR: row 70, column 7, seat ID 567.
// FFFBBBFRRR: row 14, column 7, seat ID 119.
// BBFFBBFRLL: row 102, column 4, seat ID 820.
// As a sanity check, look through your list of boarding passes. What is the highest seat ID on a boarding pass?
funcpartOne(){
f,_:=os.Open("input")
reader:=bufio.NewReader(f)
scanner:=bufio.NewScanner(reader)
maxID:=0
forscanner.Scan(){
line:=scanner.Text()
row,column:=parsePassID(line)
if(row*8)+column>maxID{
maxID=(row*8)+column
}
}
fmt.Println(maxID)
}
// It's a completely full flight, so your seat should be the only missing boarding pass in your list.
// However, there's a catch: some of the seats at the very front and back of the plane don't exist on this aircraft, so they'll be missing from your list as well.
// Your seat wasn't at the very front or back, though; the seats with IDs +1 and -1 from yours will be in your list.