INTUITION:

The problem is to determine whether the given array could be a non-decreasing, sorted array after at most one rotation. A rotated sorted array can have only one point where the order "breaks" or decreases. This means there can be at most one instance where a larger element is followed by a smaller one.

APPROACH:

Here’s the code:

class Solution {
public:
    bool check(vector<int>& nums) {
        int n=nums.size();
        int cnt=0;
        for(int i=1;i<n;i++){
            if(nums[i-1]>nums[i]){
                cnt++;
            }
        }
        if(nums[n-1]>nums[0])cnt++;
        if(cnt>1) return false;
        return true;
        
    }
};

KEYPOINTS:

Feel free to share your approach and feedback in comment box.