# Day 31: The “Find Minimum in Rotated Sorted Array” Problem

`Input: [3,4,5,1,2] Output: 1`
`Input: [4,5,6,7,0,1,2]Output: 0`
`def findMin(nums: List[int]) -> int:    left, right = 0, len(nums) - 1    while nums[left] > nums[right]:        middle  = int((left + right)/2)        if nums[middle] < nums[right]:            right = middle        else:            left = middle + 1    return nums[left]`

# Day 30: The “Capacity To Ship Packages Within D Days” Problem

`Input: weights = [1,2,3,4,5,6,7,8,9,10], D = 5Output: 15Explanation: A ship capacity of…`

# Day 29: The “Min Stack” Problem

`Input["MinStack","push","push","push","getMin","pop","top","getMin"][[],[-2],[0],[-3],[],[],[],[]]Output[null,null,null,null,-3,null,0,-2]ExplanationMinStack minStack = new MinStack();minStack.push(-2);minStack.push(0);minStack.push(-3);minStack.getMin(); // return -3minStack.pop();minStack.top();    // return 0minStack.getMin(); // return -2`
`class MinStack:   def __init__(self):        self.topNode …`

# Day 28: The “Find K Pairs with Smallest Sums” Problem

`Input: nums1 = [1,7,11], nums2 = [2,4,6], k = 3Output: [[1,2],[1,4],[1,6]] Explanation: The first 3 pairs are returned from the sequence:              [1,2],[1,4],[1,6],[7,2],[7,4],[11,2],[7,6],[11,4],[11,6]`
`Input: nums1 = [1,1,2], nums2 = [1,2,3], k = 2Output: [1,1],[1,1]Explanation: The first 2 pairs are returned from the sequence:              [1,1],[1,1],[1,2],[2,1],[1,2],[2,2],[1,3],[1,3],[2,3]`
`…`

# Day 27: The “Find the Duplicate Number” Problem

`Input: [1,3,4,2,2]Output: 2`
`Input: [3,1,3,4,2]Output: 3`
`…`

## Anjana Sudhir

Senior Software Engineer & Scrum Master @ Agoda (Booking Holdings Inc.)

Get the Medium app