leetcode.com

CA 20 - Search in Rotated Sorted Array (opens in new tab)

Discussed on DEV and DEV

<p><strong>Problem Statement:</strong> <a href="https://leetcode.com/problems/search-in-rotated-sorted-array/description/" rel="noopener noreferrer">here</a></p> <p><strong>Solution:</strong></p> <ul> <li>The array was originally sorted, but it has been rotated, so it looks broken. However, even after rotation, at any moment, at least one side of the array will still be properly sorted.</li> <li>So the idea is to keep looking at the middle element and use it to decide where to go next. Firs...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help