352.data-stream-as-disjoint-intervals.go 585 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Definition for an interval.
  3. * type Interval struct {
  4. * Start int
  5. * End int
  6. * }
  7. */
  8. type SummaryRanges struct {
  9. intervals []Interval
  10. }
  11. /** Initialize your data structure here. */
  12. func Constructor() SummaryRanges {
  13. return SummaryRanges{}
  14. }
  15. func (this *SummaryRanges) AddNum(val int) {
  16. beg, end := 0, len(this.intervals)
  17. for beg < end {
  18. }
  19. }
  20. func (this *SummaryRanges) GetIntervals() []Interval {
  21. }
  22. /**
  23. * Your SummaryRanges object will be instantiated and called as such:
  24. * obj := Constructor();
  25. * obj.AddNum(val);
  26. * param_2 := obj.GetIntervals();
  27. */