mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
init
This commit is contained in:
12
25/06/3423.go
Normal file
12
25/06/3423.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import "math"
|
||||
|
||||
func maxAdjacentDistance(nums []int) int {
|
||||
n := len(nums)
|
||||
max := int(math.Abs(float64(nums[0] - nums[n-1])))
|
||||
for i := 0; i < n-1; i++ {
|
||||
max = int(math.Max(float64(max), float64(math.Abs(float64(nums[i]-nums[i+1])))))
|
||||
}
|
||||
return max
|
||||
}
|
||||
Reference in New Issue
Block a user