Binary search template solution | Intuition Explained in detail | Video solution
Intuition\n Describe your first thoughts on how to solve this problem. \nhey every one i, have made video playlist for binary search where i discuss a template 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nhey every one i, have made video playlist for binary search where i discuss a template solution and intuition behind it, this template solution will be very useful as this will help you solve many other questions in binary search this question is the part of that playlist:\n\nVideo link for question: https://youtu.be/PJpYFuUVI48\n\nPlaylist ink: \nhttps://youtube.com/playlist?list=PLICVjZ3X1AcYYdde4GTp79zfdp_VACSkX\n\n# Code\n```\nclass Solution {\npublic:\n    int findMin(vector<int>& nums) {\n        int left=0;\n        int right=nums.size()-1;\n        while(left<right){\n            int mid= left + (right-left)/2;\n            if(nums[mid]<= nums[right]){\n                right=mid;\n            }\n            else{\n                left=mid+1;\n            }\n        }\n        return nums[left];\n    }\n};\n```
['C++']