Puzzle 2: The Best Time to Party

Ever wanted to go to a party at just the right time so you can hang out with all the cool people? Prof. Devadas describes an efficient, algorithmic way of finding this time and explains how you can write a program that computes the best time.

Flash and JavaScript are required for this feature.

Puzzle Description

Python Code

Assignment

  • Do one or more of the exercises in The Best Time to Party puzzle.

Solution

Programming Constructs and Algorithmic Paradigms Covered in this Puzzle

  • Tuples
  • Lists of tuples
  • Nested for loops and floating-point numbers
  • List splicing
  • Sorting