6.S095 | January IAP 2018 | Undergraduate

Programming for the Puzzled

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.

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

Course Info

Instructor
As Taught In
January IAP 2018
Learning Resource Types
Lecture Videos
Programming Assignments with Examples