Search in a rotated array

code : https://ide.codingblocks.com/s/220030

i am getting all test cases passed… is this approach correct?

hello @chaman9 ,
Actually u are using linear search linear search to find the required element which is totally correct (time complexity -> O(n) ).

but we can use binary search (O(logn)as well by adding some modifications to it.
try it .

okay thankyou for information