Art of code problem 2015

package main

import (

func main(){
input, err := ioutil.ReadFile("./inputtext.txt")
if err != nil {
presents := strings.Split(string(input), “\n”)

total := 0

for _, present := range presents{
	sides := []int{}

	for _, sideString := range strings.Split(present, "x"){
		side, _ := strconv.Atoi(sideString)
		sides = append(sides, side)

	total += 3 * sides[0] * sides[1]
	total += 2 * sides[1] * sides[2]
	total += 2 * sides[0] * sides[2]

Guys, this is involving the art of code day 2 problem, part 1, 2015. I think my code is right. but the site keeps saying , answer is too low. Please check if there is any problem with my code.

Why not sizing (setting capacity) sides with the length of strings.Split(present, “x”) (of course extracted from the loop as a variable) and then use index ? Each time you append an item to a slice, if capacity is not enough (here its capacity is zero!), you miss time to allocate new room for your item and reassign value.

Can you provide a link to the problem statement?

From the code it looks like your input is something like 3x5x4, from which you compute 334+245+235, but it’s hard to figure if this matches the problem or not.