Search in a Rotated Sorted Array (LeetCode 33) | Full solution with examples | Study Algorithms
Nikhil Lohia Nikhil Lohia
49K subscribers
17,057 views
391

 Published On Mar 5, 2021

You are required to return the index of a target element in a sorted rotated array. It is given that all the elements of the array are unique and we don't know how many times the array has been rotated. Watch this video to understand the problem statement and see what problems you might face with a conventional approach. I then work along with you to solve the problem in an efficient manner using a modified version of Binary Search. All along with visuals and explanations.

00:00 - Intro
00:55 - Problem Statement and description
02:34 - Brute Force Solution
04:11 - Method 1: Using Binary Search 2 times
06:41 - Method 2: Modified Binary Search
10:10 - Dry-run of Code
13:51 - Final Thoughts

📚 Links to topics I talk about in the video:
Brute Force Algorithm:    • Brute Force algorithms with real life...  
Linear Search:    • Linear Search Algorithm with step-by-...  
Binary Search:    • Binary Search Algorithm with step-by-...  
Recursion Algorithm Paradigm:    • Recursion paradigms with real life ex...  
Time Complexity of an Algorithm:    • What is the Time Complexity of an Alg...  

Actual problem on LeetCode: https://leetcode.com/problems/search-...

📘 A text based explanation is available at: https://studyalgorithms.com/array/sea...

Code on Github: https://github.com/nikoo28/java-solut...
Test-cases on Github: https://github.com/nikoo28/java-solut...

📖Reference Books:
Starting Learn to Code: https://amzn.to/36pU0JO
Favorite book to learn algorithms: https://amzn.to/39w3YLS
Favorite book for data structures: https://amzn.to/3oAVBTk
Get started for interview preparation: https://amzn.to/39ysbkJ

🔗 To see more videos like this, you can show your support on: https://www.buymeacoffee.com/studyalg...

My Recording Gear:
Recording Light: https://amzn.to/3pAqh8O
Microphone: https://amzn.to/2MCX7qU
Recording Camera: https://amzn.to/3alg9Ky
Tablet to sketch and draw: https://amzn.to/3pM6Bi4


💻 Get Social 💻
Follow on Facebook at:   / studyalgos  
Follow on Twitter at:   / studyalgorithms  
Follow on Tumblr at:   / studyalgos  
Subscribe to RSS feeds: https://studyalgorithms.com/feed/
Join fan mail: http://eepurl.com/g9Dadv

#leetcode #programming #interview

show more

Share/Embed