MCPcopy Create free account
hub / github.com/VanjaRo/LeetCode / expandFromMiddle

Function expandFromMiddle

tasks/34.go:38–56  ·  view source on GitHub ↗
(nums *[]int, target, ind int)

Source from the content-addressed store, hash-verified

36}
37
38func expandFromMiddle(nums *[]int, target, ind int) []int {
39 right := ind
40 left := ind
41 for ; right < len(*nums); right++ {
42 if (*nums)[right] != target {
43 break
44 }
45 }
46
47 for ; left >= 0; left-- {
48 if (*nums)[left] != target {
49 break
50 }
51 }
52 left++
53 right--
54 return []int{left, right}
55
56}

Callers 1

searchRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected