Check Alternating Peaks and Valleys in a Circular Array

Given an integer array nums of length n, treat it as a circular array: nums[0] and nums[n - 1] are adjacent.

Determine whether all values form a strict alternating high-low pattern. For e...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: