MCPcopy
hub / github.com/austingebauer/go-leetcode / waterCanFlow

Function waterCanFlow

pacific_atlantic_water_flow_417/solution.go:164–171  ·  view source on GitHub ↗
(matrix [][]int, pr, pc, ro, co, rd, cd int)

Source from the content-addressed store, hash-verified

162}
163
164func waterCanFlow(matrix [][]int, pr, pc, ro, co, rd, cd int) bool {
165 // if the next flow destination has reached pacific, atlantic,
166 // or has a value less than or equal to the origin value
167 return (pr != rd || pc != cd) &&
168 (reachedAtlantic(matrix, rd, cd) ||
169 reachedPacific(rd, cd) ||
170 matrix[ro][co] >= matrix[rd][cd])
171}

Callers 2

canReachPacificFunction · 0.85
canReachAtlanticFunction · 0.85

Calls 2

reachedAtlanticFunction · 0.85
reachedPacificFunction · 0.85

Tested by

no test coverage detected