Binary Search in Rotated Sorted Array on LeetCode

🚀 Day 11 of #100DaysOfCode Solved Find Minimum in Rotated Sorted Array on LeetCode using Binary Search 🔄 🧠 Key insight: In a rotated sorted array, at least one half is always sorted. By comparing the middle element with the right boundary, we can determine which half contains the minimum and safely discard the other. ⚙️ Approach: 🔹Use binary search on the array 🔹Compare nums[mid] with nums[right] 🔹If nums[mid] > nums[right] → minimum lies in the right half 🔹Else → minimum lies in the left half (including mid) ⏱️ Time Complexity: O(log n) 📦 Space Complexity: O(1) #100DaysOfCode #LeetCode #DSA #BinarySearch #Java #ProblemSolving #LearningInPublic #CodingJourney

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories