ShowClix Interview Puzzle

Your younger sister is putting on a puppet show in your family's back yard. She has left you in charge of ticketing the big event. She has informed you that she wants assigned seating. She plans on setting up 33 seats; 3 rows with 11 seats each. She already has several seats reserved for her parents and best friends. Being a good computer scientist, you decide to whip up a quick program to help her out.


Write two functions, "build" and "reserve", as described below

build(rows, cols, reserved)

Simply builds and returns a data structure to represent a seating map. See the "Initial Data" section below for the default arguments.

reserve(map, n)

Reserves the best available (see "Additional Notes" below) contiguous block of n seats and returns map with those seats reserved

The reserve function should:

  1. Find the best available seats
  2. Mark those seats as reserved in the seating map
  3. Print the start and end seats that were just reserved (e.g. reserve(map, 3) could print "R1C4-R1C6")
  4. Return map with these seated now reserved
  5. If its not possible to fulfill a request, print "Not Available" and return the map as is

Initial Data

Your starting map should have these 6 seats reserved for parents and friends:
R1C4 R1C6 R2C3 R2C7 R3C9 R3C10

By default, per your sisters initial seating map, your build method should be called with
build(3, 11, ["R1C4","R1C6","R2C3","R2C7","R3C9","R3C10"])

Additional Notes

Solutions Judged On


Email Solutions to the 1 <<3 | 0xC0DE (local name evaluated and in base 10 format, e.g.

We are looking for clever, well-documented and efficient solutions, although don't get too caught up with nitty gritty optimization. We program primarily in PHP 5 but you may write the solution in whatever language you are most comfortable with. If you have any recent source code you would like to share (or a GitHub account) please feel free to do so as well.