🚨 C++ || Two pass
Intuition\n- Find the index of the smallest element\n- Starting from that smallest element index check if traversing the full array is giving the sorted sequenc
**Intuition**\n- Find the `index` of the smallest element\n- Starting from that smallest element index check if traversing the full array is giving the sorted sequence\n\n**Code**\n```c++\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int min_elem = INT_MAX, min_at_index = -1, n = nums.size();\n        for (int i = 0; i < nums.size(); i++) {\n            min_elem = min(min_elem, nums[i]);\n            if (min_elem == nums[i]) min_at_index = i;\n        }\n        \n        for (int i = min_at_index, prev = -1; i < min_at_index + n; i++) {\n            auto actual = i % n;\n            if (prev > nums[actual]) return -1;\n            prev = nums[actual];\n        }\n        return min_at_index ? n - min_at_index: min_at_index;\n    }\n};\n```\n\n**For more solutions and concepts, check out this \uD83D\uDCD6 [BLOG](https://github.com/MuhtasimTanmoy/notebook)  and  \uD83C\uDFC6 [GITHUB REPOSITORY](https://github.com/MuhtasimTanmoy/playground) with over 2000+ solutions.**
['C']