CodeWithARB
CodeWithARB
  • Видео 167
  • Просмотров 54 733
Cousins in Binary Tree II (LeetCode 2641) (BFS)
Watch at 1.25x or 1.5x
Solution and Explaination of Leetcode POTD:
Question: leetcode.com/problems/cousins-in-binary-tree-ii/description/
Solution1: leetcode.com/problems/cousins-in-binary-tree-ii/submissions/1431067514/
Solution2: leetcode.com/problems/cousins-in-binary-tree-ii/submissions/1431078208/
#dsa #dsalgo #arrays #queue #bfs #leetcodemedium #leetcode #array #CousinsinBinaryTreeII #leetcodepotd #tree #trees #preorder #levelorder #sortingalgorithm #sorting #leetcode #leetcodetoday #potd #todaypotd #corporate #interview #placement #coding #memes #leetcodechallenge #leetcodesolutions #LeetCode2642 @CodeWithARB
Просмотров: 192

Видео

Kth Largest Sum in a Binary Tree (LeetCode 2583) (Level Order Traversal, Min Heap)
Просмотров 10314 часов назад
Watch at 1.25x or 1.5x In this Video, i have explained the solution of Kth Largest Sum in a Binary Tree problem. Here, i have explained the solution using level order traversal, sorting and Min Heap. You can learn how to implement and analyze the time and Space complexity. Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/kth-largest-sum-in-a-binary-tree/description/ S...
Parsing A Boolean Expression (LeetCode 1106) (Hard) (String, Stack)
Просмотров 13019 часов назад
Watch at 1.5x or 1.75x In this Video, I explained the solution for Parsing A Boolean Expression problem. i have solved the problem using Stack. It's the same approach as Valid Parenthesis. Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/parsing-a-boolean-expression/description/ Solution: leetcode.com/problems/parsing-a-boolean-expression/submissions/1428045524/ 0:00 ...
XOR Queries of a Subarray (LeetCode 1310) (Bit Manipulation)
Просмотров 98Месяц назад
Watch at 1.25x or 1.5x Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/xor-queries-of-a-subarray/description/ Using an extra array Solution1: leetcode.com/problems/xor-queries-of-a-subarray/submissions/1388343856/ No extra space (Optimal) Solution2: leetcode.com/problems/xor-queries-of-a-subarray/submissions/1388346138/ 0:00 Understanding the Problem 02:10 Xor Proper...
Insert Greatest Common Divisors in Linked List ( LeetCode 2807 ) (Linked List)
Просмотров 57Месяц назад
Watch at 1.25x or 1.5x Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/insert-greatest-common-divisors-in-linked-list/description/ Solution: leetcode.com/problems/insert-greatest-common-divisors-in-linked-list/submissions/1384916615/ #dsachallenge #dsa #linkedlists #linkedlist #dsalgo #arrays #leetcodemedium #leetcodehard #spiral #sorting #sortingalgorithms #sorting ...
Spiral Matrix IV (LeetCode 2326) (Linked List)
Просмотров 109Месяц назад
Watch at 1.25x or 1.5x Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/spiral-matrix-iv/description/ Solution: leetcode.com/problems/spiral-matrix-iv/submissions/1383826818/ 0:00 Understanding the question 01:20 Approach 06:07 Implementation 14:01 Time and Space Complexity #dsachallenge #dsa #linkedlists #linkedlist #dsalgo #arrays #leetcodemedium #leetcodehard #spir...
Split Linked List in Parts (LeetCode 725) (Linked List)
Просмотров 158Месяц назад
Watch at 1.25x or 1.5x Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/split-linked-list-in-parts/description/ Solution: leetcode.com/problems/split-linked-list-in-parts/submissions/1382887180/ 0:00 Understanding the question 02:28 Approach 07:35 Implementation 14:30 Question for You 16:30 Time and Space Complexity #dsachallenge #dsa #linkedlists #linkedlist #tree #r...
Linked List in Binary Tree (LeetCode 1367) (DFS, Tree)
Просмотров 165Месяц назад
Watch at 1.25x or 1.5x Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/description/ Solution: leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/submissions/1380625795/ 0:00 Understanding the question 02:50 Approach 11:12 Implementation 16:15 Time and Space Complexity #dsachallenge #dsa #linkedlists #li...
Delete Nodes From Linked List Present in Array (LeetCode 3217) (LinkedList, HashMap)
Просмотров 160Месяц назад
Watch at 1.25x or 1.5x Solution and Explaination of Leetcode POTD: Question: leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/description/ Solution: leetcode.com/problems/delete-nodes-from-linked-list-present-in-array/submissions/1380625795/ 0:00 Understanding the question 02:20 Approach 06:30 Implementation 12:15 Time and Space Complexity #dsachallenge #dsa #linkedlists #li...
Find Missing Observations (LeetCode 2028) (Array, Maths)
Просмотров 397Месяц назад
Find Missing Observations (LeetCode 2028) (Array, Maths)
Walking Robot Simulation (LeetCode 874) (Array, Hashtable)
Просмотров 777Месяц назад
Walking Robot Simulation (LeetCode 874) (Array, Hashtable)
Sum of Digits of String After Convert (LeetCode 1945) (Array, Maths)
Просмотров 367Месяц назад
Sum of Digits of String After Convert (LeetCode 1945) (Array, Maths)
Find the Student that Will Replace the Chalk (LeetCode 1894) (Maths, Arrray)
Просмотров 110Месяц назад
Find the Student that Will Replace the Chalk (LeetCode 1894) (Maths, Arrray)
Find K-th Smallest Pair Distance (LeetCode 719) (Hard) (3 Approaches) (Binary Search,Sliding Window)
Просмотров 8212 месяца назад
Find K-th Smallest Pair Distance (LeetCode 719) (Hard) (3 Approaches) (Binary Search,Sliding Window)
Combination Sum II (LeetCode 40) (Recursion, Backtracking)
Просмотров 3172 месяца назад
Combination Sum II (LeetCode 40) (Recursion, Backtracking)
Kth Largest Element in a Stream (LeetCode 703) (2 Approaches) (Heap)
Просмотров 4142 месяца назад
Kth Largest Element in a Stream (LeetCode 703) (2 Approaches) (Heap)
Minimum Number of Days to Disconnect Island (LeetCode 1568) (HARD) (DFS) (GRAPH)
Просмотров 5282 месяца назад
Minimum Number of Days to Disconnect Island (LeetCode 1568) (HARD) (DFS) (GRAPH)
Regions Cut By Slashes (LeetCode 959) (DFS) (Graph)
Просмотров 5022 месяца назад
Regions Cut By Slashes (LeetCode 959) (DFS) (Graph)
Magic Squares In Grid (LeetCode 840) (Simple Explaination)
Просмотров 1372 месяца назад
Magic Squares In Grid (LeetCode 840) (Simple Explaination)
Spiral Matrix III (LeetCode 885) (Easily Explained)
Просмотров 1,3 тыс.2 месяца назад
Spiral Matrix III (LeetCode 885) (Easily Explained)
Minimum Number of Pushes to Type Word II (LeetCode 3016) (Sorting, Greedy)
Просмотров 2992 месяца назад
Minimum Number of Pushes to Type Word II (LeetCode 3016) (Sorting, Greedy)
Kth Distinct String in an Array (LeetCode 2053) (2 Approaches) (HashMap)
Просмотров 1812 месяца назад
Kth Distinct String in an Array (LeetCode 2053) (2 Approaches) (HashMap)
Make Two Arrays Equal by Reversing Subarrays (LeetCode 1460) (Sorting, counter)
Просмотров 3462 месяца назад
Make Two Arrays Equal by Reversing Subarrays (LeetCode 1460) (Sorting, counter)
Minimum Swaps to Group All 1's Together II (LeetCode 2134) (Sliding Window)
Просмотров 4852 месяца назад
Minimum Swaps to Group All 1's Together II (LeetCode 2134) (Sliding Window)
Filling Bookcase Shelves (LeetCode 1105) (Recursion + Memoization) (DP)
Просмотров 8092 месяца назад
Filling Bookcase Shelves (LeetCode 1105) (Recursion Memoization) (DP)
Minimum Deletions to Make String Balanced (LeetCode 1653) (3 Approaches) (DP)
Просмотров 6442 месяца назад
Minimum Deletions to Make String Balanced (LeetCode 1653) (3 Approaches) (DP)
Count Number of Teams (LeetCode 1395) (Recursion+Memoization) (DP)
Просмотров 8442 месяца назад
Count Number of Teams (LeetCode 1395) (Recursion Memoization) (DP)
Minimum Cost to Convert String I (LeetCode 2976) (Floyd Warshall Algorithm)
Просмотров 2713 месяца назад
Minimum Cost to Convert String I (LeetCode 2976) (Floyd Warshall Algorithm)
Find the City With the Smallest Number of Neighbors at a Threshold Distance (LeetCode 1334) (Graph)
Просмотров 2993 месяца назад
Find the City With the Smallest Number of Neighbors at a Threshold Distance (LeetCode 1334) (Graph)
Sort an Array (LeetCode 912) (Counting Sort)
Просмотров 1733 месяца назад
Sort an Array (LeetCode 912) (Counting Sort)

Комментарии

  • @psionl0
    @psionl0 2 дня назад

    Fancy that. Yet again my response to the second part of your question has been deleted. Somebody is trying to prevent us from communicating. I give up.

  • @newtech2930
    @newtech2930 4 дня назад

    14:44 to 18:41 , this is right intuition and wonderful explanation, i watched more than 10+ videos ,no one explained. Thank so much bro.

    • @CodeWithARB
      @CodeWithARB 3 дня назад

      @@newtech2930 Glad it helps 🙂

  • @Hpktube
    @Hpktube 5 дней назад

    Nice explaination!!

  • @psionl0
    @psionl0 5 дней назад

    O(m log k) is not necessarily the most efficient use of a PQ. If you have the ability to "heapify" an array (this is usually a O(m) operation) then you can use the m sized max heap and pop the top (k - 1) times for a run time of O(m + k log m) which is usually faster - especially if k is small.

    • @CodeWithARB
      @CodeWithARB 5 дней назад

      First question - which time complexity is higher ? mlogK or (m+klogm) As much i understood your logic, we need to insert all the elements inside max heap . In that case, it will be O(M logM + k) For each insertion,it will take logM in worst case.

    • @psionl0
      @psionl0 4 дня назад

      @@CodeWithARB as for the mlogK or (m+klogm) question, consider the case where k = 32 and m = 64. lg k = 5 and lg m = 6 so in the first case we get 64 * 5 = 320 and in the second case we get 64 + 32*6 = 256. The difference is more pronounced for larger values of m.

    • @CodeWithARB
      @CodeWithARB 4 дня назад

      @@psionl0 The first question is just a brain teaser. The main question is still the second one that i don't think that for maxheap, TC will be kLogM. I already stated the reason in previous comment.

    • @psionl0
      @psionl0 3 дня назад

      @@CodeWithARB Are you deleting some of my responses? This is the second time that my response to your second point has been deleted.

    • @CodeWithARB
      @CodeWithARB 3 дня назад

      @@psionl0 No, why would i do that ?

  • @CodeWithARB
    @CodeWithARB 5 дней назад

    Note -> We can easily optimize it to TC -> O(N) and SC -> O(N). As i am little busy, so i have told you that in Video. You can check the optimized solution in Description. Thank you

  • @AbhisarMohapatra
    @AbhisarMohapatra 8 дней назад

    Such a nice explanation

    • @CodeWithARB
      @CodeWithARB 8 дней назад

      @@AbhisarMohapatra Thank you

  • @Vivek-qc8qo
    @Vivek-qc8qo 26 дней назад

    are you from INDIA ?

  • @Maahi-n1
    @Maahi-n1 Месяц назад

    Sir i think you can upload a small videos on shorts so that the channel get popular because your channel have the potential of big channel i watch your videos regularly it was helpful for me to grasp in-depth knowledge

    • @CodeWithARB
      @CodeWithARB Месяц назад

      Ok I will try. Thanks for suggestions

  • @RajarshiBangal
    @RajarshiBangal Месяц назад

    I am a little late. But it's done.🔥🔥

  • @RajarshiBangal
    @RajarshiBangal Месяц назад

    Today's problem done✅

  • @Dhami-b9r
    @Dhami-b9r Месяц назад

    great!!

  • @38shashwatshukla89
    @38shashwatshukla89 Месяц назад

    nice

  • @RajarshiBangal
    @RajarshiBangal Месяц назад

    Why did you break your streak😢?

    • @CodeWithARB
      @CodeWithARB Месяц назад

      I got hit with a viral fever, and it took me over 10 days to recover. But I'm back in action now 💪😅

    • @RajarshiBangal
      @RajarshiBangal Месяц назад

      @@CodeWithARB I see. I am very glad that you are alright now😊. I hope one day I can get a streak like you did✊🏽✊🏽.

  • @RajarshiBangal
    @RajarshiBangal Месяц назад

    Done✊🏼

  • @RajarshiBangal
    @RajarshiBangal Месяц назад

    As always, great explanation.

  • @rahulnayak5328
    @rahulnayak5328 Месяц назад

    sir try to do dry runs of diff example..

    • @CodeWithARB
      @CodeWithARB Месяц назад

      Are you facing difficulty to understand with sample example ? I mostly take different example if the sample example is not able to clarify the whole intution of solution

  • @RajarshiBangal
    @RajarshiBangal Месяц назад

    You were out for sometime. Good to have you back brother.🤠

  • @locle5227
    @locle5227 Месяц назад

    could you make a video for this problem with backtracking solution Minimum Number of Work Sessions to Finish the Tasks

  • @austecon6818
    @austecon6818 2 месяца назад

    But [1,1,6] is also a solution, I don't get how it still will include the 1 twice

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Solution cannot contain duplicate combinations. There is no restriction given in question regarding candidate number in a particular combination. Hope you understood.🙂

  • @АлибекЗарбиев
    @АлибекЗарбиев 2 месяца назад

    thank you for your video !! ❤

  • @mdsajidanwar6416
    @mdsajidanwar6416 2 месяца назад

    I solved this problem using bucket sort, but glad to know this beautiful approach ❤ Bro Union-find wale playlist ka intezar or kb tk wait krna hoga ?

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Bro, i hardly get time for making these daily problem videos. I can make extra videos only on Weekends. So, it will take sometime.

  • @kartikeyasingh5172
    @kartikeyasingh5172 2 месяца назад

    very good explanation.

  • @syedkamran4121
    @syedkamran4121 2 месяца назад

    The most important point, which language you're using, is missing

  • @syedkamran4121
    @syedkamran4121 2 месяца назад

    In title or description, i don't see which language you're using..

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Sure, i will add it next from next time. Thank you for the feedback 🙂

  • @n00berdoober
    @n00berdoober 2 месяца назад

    Good work man. Thanks for the explanation ❤

  • @locle5227
    @locle5227 2 месяца назад

    thank you for great explanation and great idea

  • @mdsajidanwar6416
    @mdsajidanwar6416 2 месяца назад

    Thank You bro ❤ bro can you explain the same problem using union-find too, it would be helpful

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      I am thinking of making a playlist of Union Find problems. I will add solution in that playlist. It will take sometime . Sorry for that Hope you understand. Thank you 🙂

  • @Maahi-n1
    @Maahi-n1 2 месяца назад

    Such a beautiful explanation ❤

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Glad you liked it 🙂

  • @이유빈-g3e
    @이유빈-g3e 2 месяца назад

    thank you for easy explanation!

  • @ShivamMaurya-ee4zp
    @ShivamMaurya-ee4zp 2 месяца назад

    Please can u tell ur leetcode id want to see ur submission

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Check Description

    • @ShivamMaurya-ee4zp
      @ShivamMaurya-ee4zp 2 месяца назад

      There is no leetcode id in description please give it😢 I just need ur help in my coding journey ​@@CodeWithARB

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      @@ShivamMaurya-ee4zp just check solution link

  • @saintboimike
    @saintboimike 2 месяца назад

    you are a genius sir

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Thank you if you think so😅 but It’s just practice

  • @Everyday_smarter
    @Everyday_smarter 2 месяца назад

    hi bro ! i see u are putting lot of efforts on solution, it is my one of the long-time desire to create educational content, if you are okey i would like to contribute towards making such educational videos, but covering other topics as well... i'm afraid of starting new things since you have already started and having a similar-minded person like you would be very helpful and motivating to kick start myself, looking forward for your response! thanks!

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Sure, send me your email id

    • @Everyday_smarter
      @Everyday_smarter 2 месяца назад

      @@CodeWithARB yt removed email I don't know why, this is my leetcode user name : demon_code from their you can get my LinkedIn their we can connect

  • @Harsh_Pandey
    @Harsh_Pandey 2 месяца назад

    Your way of explaining and then typing code in the ordered way as you explained is very good thing, unique way

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Thanks for the feedback 🙂

  • @sragopal
    @sragopal 2 месяца назад

    111000 how it requires 3 swaps?? it only need 2 right :?

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      this array need 0 swaps. All the 1's are already grouped together.

  • @Versha_arya
    @Versha_arya 2 месяца назад

    very well explained

  • @wainbai7750
    @wainbai7750 2 месяца назад

    Thank you bro. I still can't understand memorization part. The execution shouldn't be like a tree? Left branch is put to next shelf, right is put to same shelf. Every recursive is necessary? 1 / \ 2 / \ 3 / \ ... / ⑦ \ n - 1 /③ \④ n /① \② /⑤ \⑥ If the execution done ① and ②, store the value "dp [ n ] [ width ] = xx", then go back to ③. Then it will start from ④. The execution is from ⑤ to ⑥, then will it found "dp[ n ][ width ]" has the value that previous get from ① and ②. Then return and give the control back to ④ , then ④ back to ⑦. Is ④ better then ③?It has lower height since it's put on the same shelf instead of put on a new shelf? Am I understand right? Thx if and explanation!

    • @wainbai7750
      @wainbai7750 2 месяца назад

      Idk which part is duplicate in the tree need to skip during execution

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      yeah, you understood it right. we are just trying to add a book to the current shelf and next one both and finding the minimum height. If you have solved some standard problem of 2D dp like knapsack then you must have include and exclude the current element and return the minimum of the value which we get from both. This is just same with the slightest twist that we are maintaining the height of book for ans. Don't take larger number of books. books = [[1,3],[2,4],[3,2]], shelfWidth = 6 just make a complete recursion tree on this and you will better understand this. Thank you. Let me know if you have still a doubt.

  • @skandeshkkblr3416
    @skandeshkkblr3416 2 месяца назад

    thanks a lot !! understood all but didnt understand the last part of memoization, how or where to learn that ?any particular problem to solve ? also,I am new to DP

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      The basic code is recursion which take O(2^N) and if you see the full recursion tree then you will observe that there are many overlapping subproblems(i.e. the same condition is occuring many times). In this type of scenarios, we store the conditions. so that if the same conditions occurs again then we don't need to solve it again. So, basically to know that which conditions should be part of dp. So, the variables which are changing in each recursion and that number of variables would be the conditions we need to store. So, you need to finally know the state of dp[i][w] -> represents the minimum height from i to n (Here, index and remaining width is changing again and again. If you are confused for height, we are storing the height as answer in dp[i][w]) Hope you understood. If you have any doubt, you can comment it

  • @banku7194
    @banku7194 2 месяца назад

    best explanation right from recurssion -> memoization -> tabulation thank you bro.

  • @38shashwatshukla89
    @38shashwatshukla89 2 месяца назад

    Your solutions helps alot

  • @38shashwatshukla89
    @38shashwatshukla89 2 месяца назад

    Amazing as usual ❤❤

  • @surbhisrivastava658
    @surbhisrivastava658 3 месяца назад

    The way you broke down the problem and walked through the solution made it so clear.

    • @CodeWithARB
      @CodeWithARB 2 месяца назад

      Thank you. I am glad the explanation was helpful 😄

  • @mukulkhanna5071
    @mukulkhanna5071 3 месяца назад

    bhai great explanation really helpful one

  • @Maahi-n1
    @Maahi-n1 3 месяца назад

    Bro the video explanation was vey super i never understand recursion like this because when i going for learn recursion they always teach me Fibonacci, factorial but this was fantabulous, thankyou brother keep uploading ❤❤❤

    • @Maahi-n1
      @Maahi-n1 3 месяца назад

      *very 😅

    • @CodeWithARB
      @CodeWithARB 3 месяца назад

      You made my day bro. Thank you😄

  • @DarthVader678
    @DarthVader678 3 месяца назад

    This question is a CF level question

    • @CodeWithARB
      @CodeWithARB 3 месяца назад

      This is standard problem bro.

  • @keshavgarg381
    @keshavgarg381 3 месяца назад

    bhai description mei galat q aur ans daal dia

  • @trinityhunter9057
    @trinityhunter9057 3 месяца назад

    Great explanation 👍