Shortest Uncommon Substring in an Array | Detailed Intuition | Dry Run | Leetcode 3076 | Contest 388
iPad PDF Notes - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad%20PDF%20Notes/Leetcode-3076-Shortest%20Uncommon%20Substring%20in%20an%20Array.pdf
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 36th Video of our Playlist "Strings : Popular Interview Problems".
In this video we will try to solve a very good string problem : Shortest Uncommon Substring in an Array | Detailed Intuition | Dry Run | Leetcode 3076 | Leetcode Contest 388
Share your learnings on LinkedIn, Twitter (X), Instagram, Facebook(Meta) with the hashtag #codestorywithmik & feel free to tag me.
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Problem Name : Shortest Uncommon Substring in an Array | Detailed Intuition | Dry Run | Leetcode 3076 | Contest 388
Company Tags : will update soon
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/strings/Shortest%20Uncommon%20Substring%20in%20an%20Array.cpp
Leetcode Link : https://leetcode.com/problems/shortest-uncommon-substring-in-an-array
My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My Recursion Concepts Playlist : https://www.youtube.com/watch?v=pfb1Zduesi8&list=PLpIkg8OmuX-IBcXsfITH5ql0Lqci1MYPM
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Approach Summary :
The provided code aims to find the shortest unique substrings for each string in the input array. It follows a two-step process:
1. Unique Substring Counting:
- Iterates through each string in the input array and generates all possible substrings.
- Uses a HashMap (unique_substr) to count the occurrences of unique substrings across all input strings. It also employs a `HashSet` (`seen`) to ensure each substring is counted only once per string.
2. Finding Shortest Substrings:
- For each input string, iterates through all possible substrings and selects the shortest one that is unique.
- Uses a separate String variable (shortest) to keep track of the current shortest unique substring for each input string.
- The final results are returned.
Overall, the approach employs nested loops to generate and process substrings, utilizing data structures to efficiently count unique substrings and identify the shortest unique substrings for each input string.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
05:33 - Thought Process for Super Brute Force
10:59 - Story Points for Super Brute Force
12:56 - Pseudo Code for Super Brute Force
16:37 - Improvement over Super Brute Force
19:50 - Going throught Improved Version
25:49 - Corner Case
32:42 - Coding it up
38:06 - Time & Space Complexity
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear