codestorywithMIK
codestorywithMIK
  • 895
  • 3 571 523
Crawler Log Folder | 2 Approaches | Dry Runs | Leetcode 1598 | codestorywithMIK
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 48th Video of our Playlist "Leetcode Easy : Popular Interview Problems" by codestorywithMIK
In this video we will try to solve a good practice problem : Water Bottles | 2 Approaches | Dry Runs | Leetcode 1598 | codestorywithMIK
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 : Water Bottles | 2 Approaches | Dry Runs | Leetcode 1598 | codestorywithMIK
Company Tags : Google, and some other company Online Assessment problem with slight variation
My solutions on Github(C++ & JAVA) : github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Stack/Easy/Crawler%20Log%20Folder.cpp
Leetcode Link : leetcode.com/problems/crawler-log-folder/description
My DP Concepts Playlist : czcams.com/video/7eLMOE1jnls/video.html
My Graph Concepts Playlist : czcams.com/video/5JGiZnr6B5w/video.html
My Recursion Concepts Playlist : czcams.com/video/pfb1Zduesi8/video.html
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Interview_DS_Algo
Instagram : codestorywithmik
Facebook : people/codestorywithmik/100090524295846/
Twitter : CSwithMIK
Subscribe to my channel : www.youtube.com/@codestorywithMIK
╔═╩╗╔╩╗╔═╩═╩╩╩╩╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Summary :
Approach-1: Using Simple Simulation
Description: This approach uses a single integer variable depth to simulate the traversal of folders. The depth variable is incremented when entering a folder and decremented when moving up a directory ("../"), ensuring it doesn't go below zero. The "./" operations are ignored as they do not change the directory.
Time Complexity: O(n), where n is the number of operations. Each operation is processed once.
Space Complexity: O(1), as only a single integer variable is used regardless of the input size.
Approach-2: Using Stack for Simulation
Description: This approach uses a stack to simulate the traversal of folders. Each folder name is pushed onto the stack, and when encountering "../", the stack is popped if it's not empty. The "./" operations are ignored. The size of the stack at the end represents the current depth in the folder structure.
Time Complexity: O(n), where n is the number of operations. Each operation is processed once.
Space Complexity: O(n), as the stack can potentially grow up to the number of operations if no "../" commands are encountered.
Summary
Both approaches efficiently simulate the traversal of the folder structure based on the operations given. The first approach uses a single integer to keep track of the depth, resulting in constant space usage, making it more space-efficient. The second approach uses a stack, which is more intuitive in terms of simulating folder traversal but requires additional space proportional to the number of operations. Both have the same time complexity of O(n).
✹ 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 #newyear2024
zhlédnutí: 1 705

Video

Average Waiting Time | Simple Simulation | Leetcode 1701 | codestorywithMIK
zhlĂ©dnutĂ­ 4,7KPƙed 7 hodinami
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 96th Video of our Playlist "Arrays - 1D & 2D : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good simulation problem : Average Waiting Time | Simple Simulation | Leetcode 1701 | codestorywithMIK I will explain the intuition so easily that you will never forget and start...
Find the Winner of the Circular Game | 3 Approaches | Leetcode 1823 | codestorywithMIK
zhlĂ©dnutĂ­ 7KPƙed 9 hodinami
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 3rd Video of our Playlist "RECURSION : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a very famous Recursion problem : Find the Winner of the Circular Game | 3 Approaches | Easy Explanations | Leetcode 1823 | codestorywithMIK I will explain the intuition so easily that yo...
Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK
zhlĂ©dnutĂ­ 705Pƙed 9 hodinami
iPad PDF Notes - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad PDF Notes/Segment Tree - Video - 7.pdf Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 7th video of our playlist "Segment Tree Concepts & Questions". Find the Details below : Video Name : Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK...
Water Bottles | 3 Approaches | Easy Explanations | Leetcode 1518 | codestorywithMIK
zhlĂ©dnutĂ­ 4,5KPƙed 12 hodinami
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 47th Video of our Playlist "Leetcode Easy : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good practice problem : Water Bottles | 3 Approaches | Easy Explanations | Leetcode 1518 | codestorywithMIK I will explain the intuition so easily that you will never forget and st...
Pass the Pillow | 2 Approaches | Easy Explanations | Leetcode 2582 | codestorywithMIK
zhlĂ©dnutĂ­ 3,9KPƙed 14 hodinami
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 46th Video of our Playlist "Leetcode Easy : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good practice problem : Pass the Pillow | 2 Approaches | Easy Explanations | Leetcode 2582 | codestorywithMIK I will explain the intuition so easily that you will never forget and ...
Find the Minimum and Maximum Number of Nodes Between Critical Points | 2 Ways | Leetcode 2058
zhlĂ©dnutĂ­ 4,5KPƙed 17 hodinami
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 26th Video of our Playlist "Linked List : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good practice problem on Linked List : Find the Minimum and Maximum Number of Nodes Between Critical Points | 2 Ways | Leetcode 2058 | codestorywithMIK I will explain the intuition s...
Merge Nodes in Between Zeros | 2 Approaches | Leap Of Faith | Leetcode 2181 | codestorywithMIK
zhlĂ©dnutĂ­ 4,1KPƙed 19 hodinami
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 25th Video of our Playlist "Linked List : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good practice problem on Linked List : Merge Nodes in Between Zeros | 2 Approaches | Recursion Leap Of Faith | Leetcode 2181 | codestorywithMIK I will explain the intuition so easily...
Minimum Difference Between Largest and Smallest Value in Three Moves | 2 Approaches | Leetcode 1509
zhlĂ©dnutĂ­ 6KPƙed 21 hodinou
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 95th Video of our Playlist "Arrays 1D/2D : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good Array problem : Minimum Difference Between Largest and Smallest Value in Three Moves | 2 Approaches | Easy Explanations | Leetcode 1509 | codestorywithMIK I will explain the in...
Intersection of Two Arrays II | 2 Approaches | Easy Explanations | Leetcode 350 | codestorywithMIK
zhlĂ©dnutĂ­ 4,7KPƙed dnem
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 45th Video of our Playlist "Leetcode Easy : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good practice problem : Intersection of Two Arrays II | 2 Approaches | Easy Explanations | Leetcode 350 | codestorywithMIK I will explain the intuition so easily that you will neve...
Longest Palindromic Subsequence | Using Blue Print | DP On Strings | Leetcode 516 | DP Concepts - 25
zhlĂ©dnutĂ­ 1,2KPƙed dnem
iPad PDF NOTES - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad PDF Notes/DP Concepts - Video - 25.pdf Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 25th Video of our Playlist "DP Concepts & Qns" by codestorywithMIK Longest Palindromic Subsequence Recursion Memo & Different Bottom Up - czcams.com/video/M4pfB3G-YQc/video.html This is the Sixth v...
Range Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK
zhlĂ©dnutĂ­ 1,1KPƙed dnem
iPad PDF Notes - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad PDF Notes/Segment Tree - Video - 6.pdf Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 6th video of our playlist "Segment Tree Concepts & Questions". Find the Details below : Video Name : Range Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK Video # : 6 🔍 Unr...
Query Sum II | Segment Tree Concepts & Qns | Video 5 | codestorywithMIK
zhlĂ©dnutĂ­ 798Pƙed dnem
iPad PDF Notes - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad PDF Notes/Segment Tree - Video - 5.pdf Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 5th video of our playlist "Segment Tree Concepts & Questions". Find the Details below : Video Name : Query Sum II | Segment Tree Concepts & Qns | Video 5 Video # : 5 🔍 Unraveling Segment Tree : A J...
Longest Palindromic Substring | Recursion Memo | Bottom Up | DP On Strings | Leetcode 5
zhlĂ©dnutĂ­ 1,2KPƙed dnem
iPad PDF NOTES - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad PDF Notes/Longest Palindrome String - Leetcode-05-DP Concepts-24.pdf Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 24th Video of our Playlist "DP Concepts & Qns" by codestorywithMIK This is the Sixth video of the "DP On Strings" series in this playlist. In this video we will try to...
All Ancestors of a Node in a Directed Acyclic Graph | 3 Approaches | Leetcode 2192 |codestorywithMIK
zhlĂ©dnutĂ­ 6KPƙed dnem
Whatsapp Community Link : www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A This is the 51st Video of our Playlist "Graphs : Popular Interview Problems" by codestorywithMIK In this video we will try to solve a good Graph practice problem : All Ancestors of a Node in a Directed Acyclic Graph | 3 Approaches | Thought Process | Leetcode 2192 | codestorywithMIK I will explain the intuition so easil...
Maximum Total Importance of Roads | Thought Process | Leetcode 2285 | codestorywithMIK
zhlĂ©dnutĂ­ 5KPƙed dnem
Maximum Total Importance of Roads | Thought Process | Leetcode 2285 | codestorywithMIK
Find Center of Star Graph | 2 Simple Approaches | Leetcode 1791 | codestorywithMIK
zhlĂ©dnutĂ­ 4,2KPƙed dnem
Find Center of Star Graph | 2 Simple Approaches | Leetcode 1791 | codestorywithMIK
Balance a Binary Search Tree | Simple Explanation | Leetcode 1382 | codestorywithMIK
zhlĂ©dnutĂ­ 6KPƙed 14 dny
Balance a Binary Search Tree | Simple Explanation | Leetcode 1382 | codestorywithMIK
Binary Search Tree to Greater Sum Tree | Brute | Better | Optimal | Leetcode 1038 | codestorywithMIK
zhlĂ©dnutĂ­ 6KPƙed 14 dny
Binary Search Tree to Greater Sum Tree | Brute | Better | Optimal | Leetcode 1038 | codestorywithMIK
Minimum Number of K Consecutive Bit Flips | 3 Approaches | Detailed | Leetcode 995 | 3191
zhlĂ©dnutĂ­ 9KPƙed 14 dny
Minimum Number of K Consecutive Bit Flips | 3 Approaches | Detailed | Leetcode 995 | 3191
Segment Tree | Why size is 4*n | With Proof | Video 4
zhlĂ©dnutĂ­ 1,1KPƙed 14 dny
Segment Tree | Why size is 4*n | With Proof | Video 4
Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Leetcode 1438 |Detailed
zhlĂ©dnutĂ­ 9KPƙed 14 dny
Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Leetcode 1438 |Detailed
Count Number of Nice Subarrays | 2 Approaches | Similar Concept | Leetcode 1248 | codestorywithMIK
zhlĂ©dnutĂ­ 7KPƙed 14 dny
Count Number of Nice Subarrays | 2 Approaches | Similar Concept | Leetcode 1248 | codestorywithMIK
Grumpy Bookstore Owner | Simplest Thought Process | Leetcode 1052 | codestorywithMIK
zhlĂ©dnutĂ­ 8KPƙed 14 dny
Grumpy Bookstore Owner | Simplest Thought Process | Leetcode 1052 | codestorywithMIK
Magnetic Force Between Two Balls | Simple Thought Process | Leetcode 1552 | codestorywithMIK
zhlĂ©dnutĂ­ 9KPƙed 14 dny
Magnetic Force Between Two Balls | Simple Thought Process | Leetcode 1552 | codestorywithMIK
Minimum Number of Days to Make m Bouquets | Simple Thought Process| Leetcode 1482 | codestorywithMIK
zhlĂ©dnutĂ­ 8KPƙed 21 dnem
Minimum Number of Days to Make m Bouquets | Simple Thought Process| Leetcode 1482 | codestorywithMIK
Segment Tree | Range Sum Query | Story To Code | Video 3
zhlĂ©dnutĂ­ 1,7KPƙed 21 dnem
Segment Tree | Range Sum Query | Story To Code | Video 3
Most Profit Assigning Work | Multiple Approaches | With Intuition | Leetcode 826 | codestorywithMIK
zhlĂ©dnutĂ­ 8KPƙed 21 dnem
Most Profit Assigning Work | Multiple Approaches | With Intuition | Leetcode 826 | codestorywithMIK
Segment Tree | Update Query | Story To Code | Video 2
zhlĂ©dnutĂ­ 2,1KPƙed 21 dnem
Segment Tree | Update Query | Story To Code | Video 2
Segment Tree | Introduction | Basics | Build Segment Tree | Video 1 | codestorywithMIK
zhlĂ©dnutĂ­ 5KPƙed 21 dnem
Segment Tree | Introduction | Basics | Build Segment Tree | Video 1 | codestorywithMIK

Komentáƙe

  • @sarfaraz_adil
    @sarfaraz_adil Pƙed 5 hodinami

    Can some body tell me whats wrong in this code vector<int> ans; ans.push_back(0); if(n==0){ return ans; } for(int i=1; i<= n; i++){ int count =0; for(int j=0; j<32; j++){ if((i & (1<<j))==1){ count++; } } ans.push_back(count); }return ans;

  • @user-ym1nv1pw8i
    @user-ym1nv1pw8i Pƙed 6 hodinami

    Thank you bhaiya!

  • @aizad786iqbal
    @aizad786iqbal Pƙed 6 hodinami

    class Solution { public int minOperations(String[] logs) { int level=1; for(String op : logs){ if(op.equals("./")){ continue; } else if(op.equals("../")){ if(level != 1){ level--; } } else{ level++; } } return level-1; } } a good simple problem to build confidence..

  • @sriharsha4742
    @sriharsha4742 Pƙed 7 hodinami

    Super and easy Explaination! perfect! Thank you...

  • @user-ym1nv1pw8i
    @user-ym1nv1pw8i Pƙed 7 hodinami

    Thankyou bhaiya!

  • @shikharpandya4927
    @shikharpandya4927 Pƙed 7 hodinami

    thank u sir

  • @nikhilhaspe2734
    @nikhilhaspe2734 Pƙed 9 hodinami

    || Java Solutions || // 1. With Stack class Solution { public int minOperations(String[] logs) { Stack<String> st = new Stack<String>(); for(int i=0; i<logs.length; i++){ if(logs[i].equals("../")){ if(!st.isEmpty()){ st.pop(); } }else if(logs[i].equals("./")){ continue; }else{ st.push(logs[i]); } } return st.size(); } } // 2. Without Stack class Solution { public int minOperations(String[] logs) { int steps=0; for(int i=0; i<logs.length; i++){ if(logs[i].equals("./")){ continue; }else if(logs[i].equals("../")){ steps = Math.max(0, --steps); }else{ steps++; } } return steps; } }

  • @zebra-er6xc
    @zebra-er6xc Pƙed 9 hodinami

    sir os, dbms jaise core subs ke lie guide kardo ya resources bata do kaise padhe for interviews?

  • @Manjot_singh2002
    @Manjot_singh2002 Pƙed 10 hodinami

    for(string &log:logs) ka faeda kya hai & na lagae to kya farak padega ???

  • @tarunsingh2480
    @tarunsingh2480 Pƙed 10 hodinami

    Approach - Initiate the count with zero. - Iterate through the whole logs and each time when "../" appears if count >0 then there will be decreament in count. - When "./" appears then leave the count as it is. - when "x/" appears increase the count by 1. - Finally when getting out of the loop if count<0 then return 0 else return count. class Solution { public: int minOperations(vector<string>& logs) { int n = logs.size(); int cnt=0; for(int i=0;i<n;i++){ if(logs[i]=="../"){ if(cnt>0) { cnt--; } } else if(logs[i]=="./")continue; else{ cnt++; } } if(cnt<0) return 0; return cnt; } };

  • @user-ym1nv1pw8i
    @user-ym1nv1pw8i Pƙed 10 hodinami

    500 days đŸ”„

  • @Nofaltuguy1
    @Nofaltuguy1 Pƙed 10 hodinami

    500days man legendary

  • @RahulRaj-dh2rr
    @RahulRaj-dh2rr Pƙed 10 hodinami

    Mai apko kafi phle se follow kr rha and itta detail me dsa ke vids shyd hi koi bnata hai . Thanks bhaiya and waiting for 57k

  • @vishalrai6027
    @vishalrai6027 Pƙed 11 hodinami

    your explanation is fabulous. your are so consistent, bhaiya can you tell me how to stay consistent.

  • @-NITIN
    @-NITIN Pƙed 11 hodinami

    We can also store the LCS while the table is in making when : if(s1[i-1] == s2[j-1]){ lcs += s1[i-1]; dp[i][j] = 1 + dp[i-1][j-1]; } Right?

  • @tarunsingh2480
    @tarunsingh2480 Pƙed 11 hodinami

    class Solution { public: double averageWaitingTime(vector<vector<int>>& customers) { int n = customers.size(); double wait=0; double time = customers[0][0]; for(auto &it: customers){ if(time>=it[0]){ time+= it[1]; int x =time-it[0]; wait+=x; } else{ time =it[0]; time+= it[1]; int x =time-it[0]; wait+=x; } } return (wait/n); } };

  • @amarnathtripathy4350
    @amarnathtripathy4350 Pƙed 12 hodinami

    Maximum Product of Word Lengths | LeetCode 318 pe vdo bna do sir

  • @shikharpandya4927
    @shikharpandya4927 Pƙed 13 hodinami

    Thanks a lot

  • @shivamnirmalkar6251
    @shivamnirmalkar6251 Pƙed 13 hodinami

    //vector<int> getNSL(vector<int>& arr, int n) , bhaiya aapne yaha NSL likh rakha hai or aap for loop se travel kr rhe right side //for(int i = 0; i<n; i++)

  • @AdityaVerma-hh1ox
    @AdityaVerma-hh1ox Pƙed 13 hodinami

    Bhai aise hi roz upload karte raho mai aapko dekh kar proper consistent leetcode chalu kar diya hai

  • @gauravbanerjee2898
    @gauravbanerjee2898 Pƙed 13 hodinami

    Thanks a lot bhaiya ❀❀

  • @SohamChowdhury0808
    @SohamChowdhury0808 Pƙed 13 hodinami

    You make it simple sir đŸ›â€ïžand easy❀

  • @utkarshsahay9908
    @utkarshsahay9908 Pƙed 13 hodinami

    class Solution { public: int minOperations(vector<string>& logs) { stack<string> st; for(auto s : logs){ string str = s.substr(0,s.size()-1); cout<<str<<" "; if(!st.empty() && str == "..") st.pop(); else if(str == ".") continue; else if(str != "..") st.push(str); } return st.size(); } };❀❀

  • @higuys450
    @higuys450 Pƙed 13 hodinami

    Bro how u uploaded this video at 7 or 6 am !! Like when did u even recorded and edited it

    • @rishhills
      @rishhills Pƙed 12 hodinami

      Jaldi uth jata h bhai humara 😼

  • @shikharpandya4927
    @shikharpandya4927 Pƙed 13 hodinami

    After watching ur trie video I did it myself thank u for everything

    • @codestorywithMIK
      @codestorywithMIK Pƙed 13 hodinami

      So happy to hear that ❀ Keep it up

    • @shikharpandya4927
      @shikharpandya4927 Pƙed 12 hodinami

      @@codestorywithMIK yes sir trying to give my best for the coming OAs

  • @priyanshkumariitd
    @priyanshkumariitd Pƙed 14 hodinami

    Stack is useful if asked to trace the actual path back (see Leetcode editorial)

  • @contestSolutions88
    @contestSolutions88 Pƙed 14 hodinami

    Bhaiya Thanks for this video tooooo........can you make a video on Leetcode 306. Additive Number

  • @peterfromengland8663
    @peterfromengland8663 Pƙed 15 hodinami

    It was easy 🎉

  • @shikharpandya4927
    @shikharpandya4927 Pƙed 16 hodinami

    Anyone who wants to practise dsa like listening a story this is the guy u should follow :)

  • @ugcwithaddi
    @ugcwithaddi Pƙed 16 hodinami

    Good morning. I did it using stack 😊

  • @Coder_Buzz07
    @Coder_Buzz07 Pƙed 16 hodinami

    Good morning bhaiya 😊

  • @RahulSharma-ht2xz
    @RahulSharma-ht2xz Pƙed 16 hodinami

    keep doing it ....<3

  • @unemployed-coder
    @unemployed-coder Pƙed 16 hodinami

    Good morning sir, just submitted my solution and got notification of your video ❀

  • @manohar55902
    @manohar55902 Pƙed 19 hodinami

    God level of explanation by the DSA god MIK

  • @manohar55902
    @manohar55902 Pƙed 20 hodinami

    i have a doubt...can i even solve this on my own in the future...i really had this doubt from my past 1.5 year coding experience...🙄🙄

  • @darshitgajjar5199
    @darshitgajjar5199 Pƙed 21 hodinou

    You're Really helping the CP community. Big Kudos from my side!! ..... Please make this kind of Video. you motivated us to fight for our Goal

  • @xyzhacker00999
    @xyzhacker00999 Pƙed 23 hodinami

    good

  • @ayan_nema
    @ayan_nema Pƙed 23 hodinami

    sir which writing software do you use??

  • @RajanSingh-xr7cf
    @RajanSingh-xr7cf Pƙed dnem

    bro when will i think like u

  • @Shivamsingh-ry6bz
    @Shivamsingh-ry6bz Pƙed dnem

    my approach class Solution { public double averageWaitingTime(int[][] arr) { int n=arr.length; double sum=arr[0][1]; int p=arr[0][0]+arr[0][1]; for(int i=1;i<n;i++){ if(arr[i][0]<p){ p+=arr[i][1]; sum+=(p-arr[i][0]); } else{ sum+=arr[i][1]; p=arr[i][0]+arr[i][1]; } } return sum/n; } }

  • @notjod4948
    @notjod4948 Pƙed dnem

    I spent one hour and still ,I am here!

  • @user-hn9ke6ty2g
    @user-hn9ke6ty2g Pƙed dnem

    you r a gem sir

  • @AbhijeetMuneshwar
    @AbhijeetMuneshwar Pƙed dnem

    Respected MIK Sir, I solved this problem by myself. Thanks for building my logical skills. 🙇🙏 Here's my Java code: public double averageWaitingTime(int[][] customers) { int n = customers.length; double sum = 0; double previousDelay = 0; for (int[] customer: customers) { double customerArrivalTime = customer[0]; double cookingDuration = customer[1]; double cookingStartTime = Math.max(previousDelay, customerArrivalTime); double cookingEndTime = cookingStartTime + cookingDuration; double waitingTime = cookingEndTime - customerArrivalTime; previousDelay = cookingEndTime; sum += waitingTime; } return sum / n; }

  • @rahulkumar-wz9jc
    @rahulkumar-wz9jc Pƙed dnem

    Bhaiya yr aap kamaal ho daily morning uthta hu toh dekhta hu ki aapne leetcode ka potd solve krke daal diye toh esse khaafi motivation milti h ki ha bhaiya daale toh krna toh bnta h thnq bhaiya chizon ko etna aasan bnane ke liye

  • @manasdeora4601
    @manasdeora4601 Pƙed dnem

    I made the exact same logic and on my own. Though this is easy one, but I am glad that the thought process matched.

  • @shikharpandya4927
    @shikharpandya4927 Pƙed dnem

    Best Explaination for LFU😇

  • @syedhamid-ky3su
    @syedhamid-ky3su Pƙed dnem

    Based on FCFS algorithm which we studied in operating system

  • @aizad786iqbal
    @aizad786iqbal Pƙed dnem

    aaj ka question khud se kar liya... pehle mai itne bade question padh ke ghabra jaata tha.. your videos help .. bas ab series waali playlist start karni ... starting with recurison... my code intially failed beacause maine total time etc int mai le liya tha..kuch range ka issue tha I think class Solution { public double averageWaitingTime(int[][] customers) { int n = customers.length; double total_time = 0; int arrival_time = 0; int prepare_time = 0; double avg_time= 0; for(int[] x : customers){ arrival_time = x[0]; prepare_time = x[1]; if(arrival_time > total_time){ total_time += (arrival_time - total_time); } total_time += prepare_time; double waiting_time = total_time - arrival_time; avg_time += waiting_time; } return avg_time / n; } }

  • @nikhilhaspe2734
    @nikhilhaspe2734 Pƙed dnem

    Solved this one without video because of your daily videos đŸ«ĄđŸ§‘â€đŸ’». || Easy Java Solution || class Solution { public double averageWaitingTime(int[][] customers) { int totWaitTime = customers[0][0] + customers[0][1]; double waitSum = customers[0][1]; for(int i=1; i<customers.length; i++){ int[] customer = customers[i]; if(customer[0] <= totWaitTime){ totWaitTime += customer[1]; waitSum += (totWaitTime - customer[0]); } else{ totWaitTime = customer[0] + customer[1]; waitSum += customer[1]; } } return waitSum/customers.length; } }

  • @manasranjanmahapatra3729

    Hello Could you please make video solution for 2407. Longest Increasing Subsequence II. This playlist is amazingđŸ”„