Skip to content

Commit 448ded3

Browse files
committed
Time: 0 ms (100%), Space: 30.6 MB (23.04%) - LeetHub
1 parent 06ea4a9 commit 448ded3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public:
3+
int maxAdjacentDistance(vector<int>& nums) {
4+
int n = nums.size();
5+
int ans = 0;
6+
for (int i = 0; i < n; i++) {
7+
ans = max(ans, abs(nums[i] - nums[(i + 1) % n]));
8+
}
9+
return ans;
10+
}
11+
};

0 commit comments

Comments
 (0)