Sequential Digits | 2 Approaches | Leetcode 1291

  Рет қаралды 4,679

codestorywithMIK

codestorywithMIK

Күн бұрын

Whatsapp Community Link : www.whatsapp.c...
This is the 81st Video of our Playlist "Array 1D-2D : Popular Interview Problems".
In this video we will try to solve a very good Array Enumeration problem - Sequential Digits | Leetcode 1291
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.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Sequential Digits | Leetcode 1291
Company Tags : AMAZON
My solutions on Github(C++ & JAVA) : github.com/MAZ...
Leetcode Link : leetcode.com/p...
My DP Concepts Playlist : • Roadmap for DP | How t...
My Graph Concepts Playlist : • Graph Concepts & Qns -...
My GitHub Repo for interview preparation : github.com/MAZ...
Subscribe to my channel : / @codestorywithmik
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Approach-1 Summary : The first approach utilizes a queue to generate sequential digits in a breadth-first manner. It starts by enqueueing digits from 1 to 8 and then iteratively dequeues a digit, checks if it falls within the given range, and adds it to the result vector. Additionally, it enqueues the next sequential digit formed by adding one to the last digit of the current dequeued number. This process continues until the queue is empty, and the result vector contains all sequential digits within the specified range.
Approach-2 Summary : The second approach uses a precomputed list of all possible sequential digits up to nine digits in length. It then iterates through this list, filtering out numbers that are below the given low value and above the high value. The result vector is populated with the filtered numbers.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
#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

Пікірлер: 58
@ramanthakur2482
@ramanthakur2482 8 ай бұрын
my day doesn't complete before watching your POTD video....ur way of teaching is quite amazing
@AnjuGupta-sz1uk
@AnjuGupta-sz1uk 8 ай бұрын
Both approaches are very clear
@souravjoshi2293
@souravjoshi2293 8 ай бұрын
" bhai bhai approach" was awesome 🤣
@DevOpskagyaan
@DevOpskagyaan 8 ай бұрын
Bhai travel k waqt video upload. Salute to your dedication 🔥❤️
@aryanraj9235
@aryanraj9235 8 ай бұрын
last one was funny 😂😂,Are bhai bhai bhai...
@karanthakur11
@karanthakur11 8 ай бұрын
method 1: slight change (change from recur memo to one based indexing) ese bhi likh skte hein recusrion memoisation ko method 2:: ise pehle tabulation slight change from tabulation to space optimization 33:44
@codeandtalk6
@codeandtalk6 8 ай бұрын
❤❤❤❤
@Mercer_077
@Mercer_077 8 ай бұрын
13:23 First approach bhi toh O(1) hi time le rhi hai , n cant exceed 36 for given constraints.
@neerajchopra2758
@neerajchopra2758 8 ай бұрын
sir please make gfg podt today question implement Atoi explanation 😭
@shreeramsingh7652
@shreeramsingh7652 8 ай бұрын
sir, we need one detail video on while seeing any problem Constraints on any coding paltform by seeing the Constraints we should able to think which algorithm can apply and what its time complexity, Because i am seeing that in my class top coder are first he see question statement and directly they are seen Constraints and predict which algorithm i should apply ,they know basic cp, please kindly help us sir🙏🙏..
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
Definitely. Noted on this.
@naveenkumarkota2090
@naveenkumarkota2090 8 ай бұрын
keep making this videos will learn from u and we will be support mike
@AnkitSingh-tm5dp
@AnkitSingh-tm5dp 8 ай бұрын
Best Explaination , Problem is also good i never do this type of problem of I have no idea of Intuition other then recursion.
@girdharipatel2
@girdharipatel2 8 ай бұрын
are bhai bhai approach 😂
@codingdev4196
@codingdev4196 8 ай бұрын
Hacker bhai 😂
@LakhanRathod1242
@LakhanRathod1242 8 ай бұрын
Are bhai bhai bhai approach 🤣🤣🤣🤣
@bhuppidhamii
@bhuppidhamii 8 ай бұрын
waiting for today's potd
@codestorywithMIK
@codestorywithMIK 8 ай бұрын
kzbin.info/www/bejne/gqfZepaQjNmopbssi=HUQTNEfDaAWQaqsc ❤️❤️😇😇
@Trendspra
@Trendspra 8 ай бұрын
How can anyone explain programming logic so easily.....Hats off
@voidPointer040
@voidPointer040 8 ай бұрын
Interviewer be like arayy bhai bhai bhai😂😂
@souravjoshi2293
@souravjoshi2293 8 ай бұрын
@DreamPuller-cf6yl
@DreamPuller-cf6yl 8 ай бұрын
need guidance video for your videos
@amitmehraa
@amitmehraa 8 ай бұрын
man you are awesome😂😂
@thor1626
@thor1626 8 ай бұрын
A sliding window approach which beats 100% users in java : class Solution { public List sequentialDigits(int low, int high) { String nums = "123456789"; int lowerRange = 0, upperRange = 0; int lowerTemp = low, higherTemp = high; while (lowerTemp > 0) { lowerTemp /= 10; lowerRange++; } while (higherTemp > 0) { higherTemp /= 10; upperRange++; } List seqDigits = new ArrayList(); for (int i = lowerRange; i = low && temp
@Incredible2India
@Incredible2India 8 ай бұрын
2nd approch mst h 😂
@gauravbanerjee2898
@gauravbanerjee2898 8 ай бұрын
thanks a lot bhaiya ❣❣ Hats off to your dedication🫡, providing videos even when you are travelling ❤❤
@dipakdhakate5613
@dipakdhakate5613 8 ай бұрын
bhai ka samzana like "so beautiful so elegant just looking like a wow"😅
@ankurtiwari9621
@ankurtiwari9621 8 ай бұрын
I just waited for your video after trying..Thanks for your efforts becoming a big fan ..☺
@theOmKumar
@theOmKumar 8 ай бұрын
i solved it like this: brute force using sort vector sequentialDigits(int low, int high) { vector ans; for(int i = 1; i = low && res
@wearevacationuncoverers
@wearevacationuncoverers 8 ай бұрын
waiting for you. ❣ and hats off to your dedication.
@thefintechguy899
@thefintechguy899 8 ай бұрын
"are bhai bhai bhai"
@lofireverbz-wy7go
@lofireverbz-wy7go 8 ай бұрын
bhaiya placement season aara hai june mai so please kuch new cheez le aoooo tadkta bhadakta like oops or something of your choice:)!!!!!
@Idk-qg7hb
@Idk-qg7hb 8 ай бұрын
I did bhai bhai approach 😂
@souravjoshi2293
@souravjoshi2293 8 ай бұрын
same 🤣
@sachinnarang2453
@sachinnarang2453 8 ай бұрын
Beats 100% class Solution { public List sequentialDigits(int low2, int high2) { int count = 0; int low=low2,high=high2; while(low>0) { low/=10; count++; } int firstCount = count; count=0; while(high>0){ high/=10; count++; } int secondCount=count; List lis = new ArrayList(); for(int i=firstCount;i
@manimanohar_001
@manimanohar_001 8 ай бұрын
Bro LC 1247 pe ek video pls🙏🙏🙏
@S3aw0lf
@S3aw0lf 8 ай бұрын
class Solution { public List sequentialDigits(int low, int high) { List result = new ArrayList(); for (int i = 1; i
@sauravchandra10
@sauravchandra10 8 ай бұрын
My approach: class Solution { public: long create(int start, int size){ long res=start; for(int i=start+1;size>0 && i=low){ ans.push_back(curNum); } } curSize+=1; } return ans; } };
@thekindspill
@thekindspill 8 ай бұрын
dedication level 🔥🔥🔥🔥
@aws_handles
@aws_handles 8 ай бұрын
Are bhai bhai bhai 😅👌🏻
@naveenkumarkota2090
@naveenkumarkota2090 8 ай бұрын
like mardo sab log
@PiyushSingh-xg4mc
@PiyushSingh-xg4mc 8 ай бұрын
👌👌👍👍
@Shakib.Siddiqui
@Shakib.Siddiqui 8 ай бұрын
Bhai Bhai approach......is useful only for online assessment 😂
@MohammadTouseeb
@MohammadTouseeb 7 ай бұрын
Bhai ek hi dil hai kitne bar jeetoge. Ab agar koi question apne nhi kiya hota youtube pe Mai kisi or ka dekhta hi nhi chor deta hu bad me karenge😂
@harshtiwari416
@harshtiwari416 8 ай бұрын
bhai gfg ke count digits of a number ki bottom up video kab aayegi???
@DevOpskagyaan
@DevOpskagyaan 8 ай бұрын
I also am waiting . I think he is travelling and will upload when he is back. @codestorywithMIK - waiting
@ugcwithaddi
@ugcwithaddi 8 ай бұрын
🔥🔥🔥
@NikhilSatyam
@NikhilSatyam 8 ай бұрын
bhaiya pls try to upload this notes
@priyanshugouravsarangi8553
@priyanshugouravsarangi8553 8 ай бұрын
BFS FROM NOTHING HINT OF BFS FAIRS I THOUGHT OF DP FIRST
@KumarMuravath-YearBTechChemica
@KumarMuravath-YearBTechChemica 8 ай бұрын
341 😳
@manimanohar_001
@manimanohar_001 8 ай бұрын
First view
@dhairyachauhan6622
@dhairyachauhan6622 8 ай бұрын
i solved using digit dp but afterwards realized that the question was asking a vector. So there was nothing to memoize 🥲😁. But atleast this method is unique but complex and i dont know about the complexity but i guess it will be slower since i cannot memoize. Took my code (4ms) DIGIT DP (TEMPLATE)SOLUTION class Solution { public: void solve(string &R,int digit,int result,int prevDigit,int leading,bool tight,set&ans,bool erase){ if(digit == 0){ if(erase){ ans.erase(result); return; } ans.insert(result); return; } int ub = tight?(R[R.length()-digit]-'0'):9; for(int i = 0;i
@souravjoshi2293
@souravjoshi2293 8 ай бұрын
nice man
@tutuimam3381
@tutuimam3381 8 ай бұрын
❤❤❤
@mohdzaid1158
@mohdzaid1158 8 ай бұрын
are bhai bhai bhai approach 🤣🤣🤣🤣
Part 5. Roblox trend☠️
00:13
Kan Andrey
Рет қаралды 2,9 МЛН
Mom had to stand up for the whole family!❤️😍😁
00:39
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 18 МЛН
Sequential Digits | LeetCode 1291 | C++, Java, Python
14:37
Knowledge Center
Рет қаралды 7 М.
How to (actually) learn Linux
11:57
Bread on Penguins
Рет қаралды 12 М.
you will never ask about pointers again after watching this video
8:03
Naval Ravikant - How to Get Ahead of 99% of People (Starting in 2024)
11:21
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 107 М.
Dear Functional Bros
16:50
CodeAesthetic
Рет қаралды 526 М.
Physics Nobel 2024: Apparently, Machine Learning Is Physics Now
12:45
Physics but Awesome
Рет қаралды 9 М.
Part 5. Roblox trend☠️
00:13
Kan Andrey
Рет қаралды 2,9 МЛН