Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Last active April 25, 2026 07:34
Show Gist options
  • Select an option

  • Save thinkphp/d8129eaf6133aee528c18260fabd1bc7 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/d8129eaf6133aee528c18260fabd1bc7 to your computer and use it in GitHub Desktop.
valid mountain leetcode
bool validMountain(vector<int>& arr) {
int n = arr.size();
int start = 0;
int end = n - 1;
//urcare
while(start != n - 1 && arr[start+1] > arr[start]) start++;
while(end != 0 && arr[end-1] > arr[end]) end--
//0 2 3 4 5 2 1 0
return start == end && end != n-1 && start != 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment