Practical tests and job interviews

Last year I was dedicated to search good opportunities on-line and almost every position I cared started their hiring process with algorithm testing. Everything was fine until these tests started getting boring, most of them are 30 minutes vs 10 challenges format. If you try to write the amazing code time will get you, when I do awesome run my top solved are seven challenges. At the beginning I got depressed thinking if I was a proper dev.

Below is my algorithm for challenge of writing mean distance software:

```package main

import (
"fmt"
"math"
)

type point struct {
x, y float64
}

func distance(a, b point) float64 {
return math.Sqrt(math.Pow((b.x-a.x), 2.0) + math.Pow((b.y-a.y), 2.0))
}

func mean(n ...float64) float64 {
sum := 0.0
for _, v := range n {
sum += v
}
return sum / float64(len(n))
}

func meanDist(points ...point) float64 {
dsts := []float64{}
for i := 0; i < len(points); i++ {
for j := i + 1; j < len(points); j++ {
dsts = append(dsts, distance(points[i], points[j]))
}
}
return mean(dsts...)
}

func main() {
points := []point{
{0.0, 10.0},
{0.0, 20.0},
{0.0, 30.0},
}

fmt.Println(meanDist(points...))
}

```

I’m very confident which this kinda of challenge because in my master we used many types of distances and mean is the most used statistic. The reply I got “very good”, you can read this as you’re over 80% of others candidates. How on this damned world of people with formal programming classes I can write good enough code to be called to interviews? Yes, you can be confident of your skills, what your learned cannot be taken from you.