Priority Queue C++ Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    typedef priority_queue<int, vector<int>, greater<int>> PrioQueue;\n\n    int bestRotation(vector<int>& nums) {\n        PrioQueue pq;\n        int l = nums.size()-1;\n        for(int i=0;i<=l;i++){\n            if(nums[i] <= i){\n                pq.push(i-nums[i]+1);\n            }\n        }\n        int ansIndx = 0;\n        int ansSize = pq.size();\n        int t = 1;\n        for(;t<=l;t++){\n            while(!pq.empty() && t>=pq.top()){\n                pq.pop();\n            }\n            int num = nums[t-1];\n            if (num > l) continue;\n            pq.push(l-num+1+t);\n            if (pq.size() > ansSize){\n                ansSize = pq.size();\n                ansIndx = t;\n            }\n        }\n        return ansIndx;\n    }\n};\n```
['C++']