Search in a Rotated Array

Input:
N = 9
A[] = {5, 6, 7, 8, 9, 10, 1, 2, 3}
key = 10
Output:
5
Explanation: 10 is found at index 5.
Input:
N = 4
A[] = {3, 5, 1, 2}
key = 6
Output
:
-1
Explanation
: There is no element that has value 6.

--

--

--

iOS Developer, Triple graduated, Passionate, Love workout, blogger

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

8 most important problem solving examples in Javascript

JavaScript: let, var and const.

Add Correlation ID in Node.JS Applications

Testing with real files in Angular

Using the forEach Method in Javascript

LeetCode problem #39: Combination Sum (JavaScript)

Redux is dead! long live react’s context API(?)

Arrow functions in JavaScript (=>)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mr.Javed Multani

Mr.Javed Multani

iOS Developer, Triple graduated, Passionate, Love workout, blogger

More from Medium

MEAN STACK VS. MERN STACK: AN ANALYSIS OF THE TWO TECH STACKS

How to implement Picture-in-Picture in React.JS for browsers

Data Structures, Algorithms, And Big O Notation! A Beginners Guide.

Destructuring and Optional Chaining