// TODO: we need to take advantage of the fact that these are sorted arrays
// Current implementation might be taking too much memory
we need to take advantage of the fact that these are sorted arrays
Current implementation might be taking too much memory
// TODO : we need to take advantage of the fact that these are sorted arrays // Current implementation might be taking too much memory
func Union(input ...*Dimension) []Key {
	if len(input) == 0 {
		return []Key{}
	} else if len(input) == 1 {
		return input[0].keys
	}
	result := []Key{}
	isExists := map[string]bool{}
	for _, v := range input {
		for _, k := range v.keys {
			if !isExists[string(k)] {
				result = append(result, k)
			}
			isExists[string(k)] = true
		}
	}
	return result
}
func Union ( input ... * Dimension ) [ ] Key { if len ( input ) == 0 { return [ ] Key { } } else if len ( input ) == 1 { return input [ 0 ] . keys } result := [ ] Key { } isExists := map [ string ] bool { } for _ , v := range input { for _ , k := range v . keys { if ! isExists [ string ( k ) ] { result = append ( result , k ) } isExists [ string ( k ) ] = true } } return result }
we need to take advantage of the fact that these are sorted arrays
Current implementation might be taking too much memory
we need to take advantage of the fact that these are sorted arrays Current implementation might be taking too much memory