Рет қаралды 24,445
To see more videos like this, you can buy me a coffee: www.buymeacoffee.com/studyalg...
You are given an array of integers that have some values that appear twice and others appear once. Return a list of all the duplicate elements. Watch this video to learn 3 methods of solving this question. A Brute Force method, using a Hash-set with extra space and a trick to where you do not need any extra space. The biggest hint is that all the elements of the array are greater than equal to 1 and less than equal to the length of the array. Learn with great animations and visuals of what happens behind the scenes.
00:00 - Intro
01:19 - Problem Statement and description
03:24 - Method 1: Using HashSet
06:07 - Method 2: Without Extra Space
12:25 - Dry-run of Code
14:53 - Final Thoughts
📚 Links to topics I talk about in the video:
Brute Force Algorithm: • Brute Force algorithms...
Time Complexity of an Algorithm: • What is the Time Compl...
Actual problem on LeetCode: leetcode.com/problems/find-al...
📘 A text based explanation is available at: studyalgorithms.com/array/lee...
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