Search in a Rotated Sorted Array (LeetCode 33) | Full solution with examples | Study Algorithms

  Рет қаралды 12,788

Nikhil Lohia

Nikhil Lohia

Күн бұрын

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...
Linear Search: • Linear Search Algorith...
Binary Search: • Binary Search Algorith...
Recursion Algorithm Paradigm: • Recursion paradigms wi...
Time Complexity of an Algorithm: • What is the Time Compl...
Actual problem on LeetCode: leetcode.com/problems/search-...
📘 A text based explanation is available at: studyalgorithms.com/array/sea...
Code on Github: github.com/nikoo28/java-solut...
Test-cases on Github: github.com/nikoo28/java-solut...
📖Reference Books:
Starting Learn to Code: amzn.to/36pU0JO
Favorite book to learn algorithms: amzn.to/39w3YLS
Favorite book for data structures: amzn.to/3oAVBTk
Get started for interview preparation: amzn.to/39ysbkJ
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
My Recording Gear:
Recording Light: amzn.to/3pAqh8O
Microphone: amzn.to/2MCX7qU
Recording Camera: amzn.to/3alg9Ky
Tablet to sketch and draw: amzn.to/3pM6Bi4
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Follow on Twitter at: / studyalgorithms
Follow on Tumblr at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#leetcode #programming #interview

Пікірлер: 34
BS-4. Search Element in Rotated Sorted Array - I
16:38
take U forward
Рет қаралды 204 М.
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 19 МЛН
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 14 МЛН
Happy 4th of July 😂
00:12
Pink Shirt Girl
Рет қаралды 60 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,7 МЛН
LeetCode 33. Search in Rotated Sorted Array
9:30
Nick White
Рет қаралды 97 М.
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 726 М.
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 237 М.
BS-6. Minimum in Rotated Sorted Array
17:08
take U forward
Рет қаралды 133 М.
WHO LAUGHS LAST LAUGHS BEST 😎 #comedy
00:18
HaHaWhat
Рет қаралды 19 МЛН