Solution 2 in Go Lang