(Golang) Solutions to prob 3 and 5