Answer: Razorpay OA Question 2024 May | Binary Search | on-campus
Answer · Posted Jun 2026
Solution: Search in Rotated Sorted Array — Modified Binary Search Approach We apply Modified Binary Search. In a rotated sorted array, at least one half of the array is always sorted. We exploit this property: Compute mid. If nums[left] <= nums[mid], the left half is sorted: If target falls within [nums[left], nums[mid]), search the left half. Otherwise, search the right half. Else, the right half is sorted: If target falls within (nums[mid], nums[right]], search the right half. Otherwise, search the ...
The full answer & interview discussion are available to premium members.
Log in Create a free account