MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / eraseOverlapHelper

Function eraseOverlapHelper

non_overlapping_intervals_435/solution.go:58–72  ·  view source on GitHub ↗
(intervals [][]int, count int)

Source from the content-addressed store, hash-verified

56}
57
58func eraseOverlapHelper(intervals [][]int, count int) int {
59 min := math.MaxInt32
60 if !overlaps(intervals) {
61 min = count
62 }
63
64 for i := 0; i < len(intervals); i++ {
65 front := intervals[:i]
66 back := intervals[i+1:]
67 next := append(append([][]int{}, front...), back...)
68 min = int(math.Min(float64(min), float64(eraseOverlapHelper(next, count+1))))
69 }
70
71 return min
72}
73
74func overlaps(intervals [][]int) bool {
75 for j := 1; j < len(intervals); j++ {

Callers 1

eraseOverlapIntervals1Function · 0.85

Calls 1

overlapsFunction · 0.85

Tested by

no test coverage detected