Basic optimization | Computer Science homework help