DEV Community
•
2026-03-20 07:00
Search in Rotated Sorted Array
In this task, I worked on finding a target element in a rotated sorted array using an efficient approach.
A rotated sorted array is one that was originally sorted but then rotated at some pivot point.
For example: [4, 5, 6, 7, 0, 1, 2]
What I Did
I created a function search that:
Takes an array nums and a target value
Returns the index of the target if found
Returns -1 if the target...