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




  1. isEquilateralTriangle(side1,side2,side3) [5pts]
    Write the function isEquilateralTriangle(side1,side2,side3) that takes three sides to a triangle. The sides will be positive ints. Return True if the 3 sides make up an equilateral triangle.

  2. carrylessAdd [10pts]
    First, read the first page (page 44) from here about Carryless Arithmetic. Fun! Then, write the function carrylessAdd(x, y) that takes two non-negative integers x and y and returns their carryless sum. Here are a couple examples:
         carrylessAdd(785, 376) returns 51
         carrylessAdd(865, 23) returns 888
    

    Make sure you handle the case where the numbers are different lengths!

  3. inverseLookAndSay(a) [10 pts]
    Write the function inverseLookAndSay(a) that does the inverse of the lookAndSay problem from collab4, so that, in general:
      inverseLookAndSay(lookAndSay(a)) == a
    
    Or, in particular:
      slicesEqual(inverseLookAndSay([][]int{{2,3},{1,8},{3,-10}}, []int{3,3,8,-10,-10,-10}}
    
  4. Note: Since there are no tuples in Go, this version of inverseLookAndSay runs ont 2d int slices.