CMU 15-112 Summer 2020: Fundamentals of Programming and Computer Science
Collab 10 (Due Tue 9-Jun, at 11:59pm)




  1. getPairSum(a []int, target int) []int [20pts]
    In Go, write the function getPairSum from here. The function should take in an integer slice and an integer and return an integer slice of length 2. Like the linked writeup says, you should write two versions: one that runs in O(n**2) time and one than runs in O(n) time.

  2. movieAwards [20pts]
    In Go, write the function movieAwards from here. Rather than taking in a list of tuples, the function will take in a slice of winner structs. Winner structs look like this:
    type Winner struct { Category string Movie string }
    So the function signature for movieAwards should be
    func movieAwards(winners []Winner) map[string]int