Clean 2 Heaps Go Solution
\ntype Heap struct {\n\tValues   []int\n\tLessFunc func(int, int) bool\n}\n\nfunc (h *Heap) Less(i, j int) bool { return h.LessFunc(h.Values[i], h.Values[j]) }\
```\ntype Heap struct {\n\tValues   []int\n\tLessFunc func(int, int) bool\n}\n\nfunc (h *Heap) Less(i, j int) bool { return h.LessFunc(h.Values[i], h.Values[j]) }\nfunc (h *Heap) Swap(i, j int)      { h.Values[i], h.Values[j] = h.Values[j], h.Values[i] }\nfunc (h *Heap) Len() int           { return len(h.Values) }\nfunc (h *Heap) Peek() int          { return h.Values[0] }\nfunc (h *Heap) Pop() (v interface{}) {\n\th.Values, v = h.Values[:h.Len()-1], h.Values[h.Len()-1]\n\treturn v\n}\nfunc (h *Heap) Push(v interface{}) { h.Values = append(h.Values, v.(int)) }\n\nfunc NewHeap(less func(int, int) bool) *Heap {\n\treturn &Heap{LessFunc: less}\n}\n\ntype MedianFinder struct {\n\tsmallHeap *Heap\n\tlargeHeap *Heap\n}\n\nfunc Constructor() MedianFinder {\n\treturn MedianFinder{\n\t\tsmallHeap: NewHeap(func(a, b int) bool {\n\t\t\treturn a > b\n\t\t}),\n\t\tlargeHeap: NewHeap(func(a, b int) bool {\n\t\t\treturn a < b\n\t\t}),\n\t}\n}\n\nfunc (mf *MedianFinder) AddNum(num int) {\n\tif (mf.smallHeap.Len()+mf.largeHeap.Len())%2 == 0 {\n\t\theap.Push(mf.largeHeap, num)\n\t\theap.Push(mf.smallHeap, heap.Pop(mf.largeHeap))\n\t} else {\n\t\theap.Push(mf.smallHeap, num)\n\t\theap.Push(mf.largeHeap, heap.Pop(mf.smallHeap))\n\t}\n}\n\nfunc (mf *MedianFinder) FindMedian() float64 {\n\tif (mf.smallHeap.Len()+mf.largeHeap.Len())%2 == 0 {\n\t\treturn (float64(mf.smallHeap.Peek()) + float64(mf.largeHeap.Peek())) / 2\n\t}\n\treturn float64(mf.smallHeap.Peek())\n}\n```
['Heap (Priority Queue)', 'Go']