A very good problem to clarify the concepts of backtracking algorithmic paradigm. This problem is an extension to the original problem Permutations, where you are given an array of integers and you need to return all the possible different arrangements. The twist however is that this time this array could have duplicates as well. Once you understand how to backtrack and where the duplicates come from, dealing with them becomes easy. Watch the video to see the complete solution
The actual problem on LeetCode: https://leetcode.com/problems/permuta...
Chapters:
00:00 - Intro
01:10 - Problem statement and description
02:42 - Source of duplicates
05:30 - Connecting with the original problem permutations
07:25 - Fix the problems
09:44 - Dry-run of Code
12:38 - Final Thoughts
📚 Links to topics I talk about in the video:
Brute Force Paradigm: • Brute Force algorithms with real life exam...
Backtracking: • Backtracking made easy | Algorithmic Parad...
Permutations (Original problem): • Permutations (LeetCode 46) | Full solution...
Similar problem (Subsets): • Subsets (LeetCode 78) | Full solution with...
Other problems on LeetCode: • Leetcode Solutions
📘 A text based explanation is available at: https://studyalgorithms.com
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 understand 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
Surface Pen: https://amzn.to/3pv6tTs
Laptop to edit videos: https://amzn.to/2LYpMqn
💻 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