← 返回 google 的题目列表Split and Sort Array
类型:online_judge
Given an integer array A, you can split it into two non-empty parts: left and right. Sort each of these parts separately and then concatenate them into a new array. The concatenated array must be non-decreasing (ascending). How many different ways can you split the array to satisfy this condition?
Input
An integer array A.
Output
The count of splits that satisfy the condition.
Example
Input: [4, 3, 2, 1]
Output: 1
Constraints
The length of the array is between [2, 1000].
Each element is in the range [-1000, 1000].
Example
Input
4
4 3 2 1