Practice: Find Minimum in Rotated Sorted Array
Problem: https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
Recognition reminder: the same rotated-array shape as the previous problem, but there is no target to find. You are searching for the pivot itself, the single element that is smaller than the one before it, which is the minimum. The “which half is sorted” decision still drives the search.
Before you start (the five-beat rhythm)
- Your Pattern Card for this week is already written.
- Name the pattern aloud and write your approach as a plain-English comment before any code.
- Struggle floor: 25 minutes unaided. No hints, no AI, no Discuss tab.
- If stuck past the floor, ask the tutor for a hint. Six rungs, one per ask.
- Debrief in your commit message before moving to the next problem.
Your target
Fill these in yourself before you look at anyone else’s solution:
Target time complexity: ____
Target space complexity: ____
Required complexity is O(log n), so taking the min of the whole array misses the point. The move to find is the same one as the previous problem: a comparison between nums[mid] and an endpoint tells you which side the pivot is on. Work out for yourself which endpoint to compare against and which way each outcome sends you. Decide whether your range is inclusive or half-open before you write the loop, and watch the already-sorted (un-rotated) input as an edge case.
Where your code goes
Write your solution in your own work repo (see getting-started.md), not in this folder. This folder ships only the problem spec and a provided-example test (tests/test_provided.py) so you can check the given cases locally before you submit to LeetCode’s judge. The judge is the oracle; the tutor will not confirm your answer by reading it.
Debrief (paste into your commit message)
1. What pattern did this turn out to be?
2. What was the trigger phrase or input shape that should have made me reach for it?
3. What was the time and space complexity, and what would dominate at scale?
4. What edge case would have broken my first attempt?
5. What would I do differently in three days when I see this cold?