CMU 15-112: Fundamentals of Programming and Computer Science
Extra Practice for Unit 10 (Due never)

  1. Efficiency practice problems
    Linked here

  2. containsPythagoreanTriple(a []int) bool
    Write the function containsPythagoreanTriple that takes a slice of positive integers and returns true if there are three values x,y,z anywhere in the slice such that (x,y,z) form a Pythagorean Triple (where x^2 + y^2 == z^2). For example, containsPythagoreanTriple([]int{1,3,6,2,5,1,4}) returns true because of (3,4,5). A naive solution would be to check every possible triple (x,y,z) in the list. That runs in O(n^3). You'll have to do better than that!