shashCode
shashCode
  • Видео 480
  • Просмотров 1 014 835
2096. Step-By-Step Directions From a Binary Tree Node to Another | Leetcode POTD | DSA | Hindi
(Please watch LCA, before watching this video)
LCA:
ruclips.net/video/m9NKcTvrhSc/видео.htmlsi=OfyrA2JwaGu02vls
Problem Name:
2196. Create Binary Tree From Descriptions
Problem Statement:
You are given the root of a binary tree with n nodes. Each node is uniquely assigned a value from 1 to n. You are also given an integer startValue representing the value of the start node s, and a different integer destValue representing the value of the destination node t.
Find the shortest path starting from node s and ending at node t. Generate step-by-step directions of such path as a string consisting of only the uppercase letters 'L', 'R', and 'U'. Each letter indicates a specific direction:
'L' means to g...
Просмотров: 144

Видео

Lecture-9 126. Word Ladder 2 | GFG | leetcode | Graph Traversal | Graph Series | DSA | Hindi
Просмотров 6620 часов назад
Problem Name: 127. Word Ladder Problem Statement: A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord - s1 - s2 - ... - sk such that: Every adjacent pair of words differs by a single letter. Every si for 1 = i = k is in wordList. Note that beginWord does not need to be in wordList. sk endWord Given two words, beginWord and e...
2196. Create Binary Tree From Descriptions | Trees | Leetcode Daily Challenge | DSA | Hindi
Просмотров 1,6 тыс.2 часа назад
Problem Name: 2196. Create Binary Tree From Descriptions Problem Statement: You are given a 2D integer array descriptions where descriptions[i] = [parenti, childi, isLefti] indicates that parenti is the parent of childi in a binary tree of unique values. Furthermore, If isLefti 1, then childi is the left child of parenti. If isLefti 0, then childi is the right child of parenti. Construct the bi...
726. Number of Atoms | Stacks | Leetcode Daily Challlenge | DSA | Hindi
Просмотров 1,8 тыс.4 часа назад
Problem Name: 726. Number of Atoms Problem Statement: Given a string formula representing a chemical formula, return the count of each atom. The atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name. One or more digits representing that element's count may follow if the count is greater than 1. If the count is 1, no digits will foll...
2751. Robot Collisions | Stacks | Leetcode Daily Challlenge | DSA | Hindi
Просмотров 1,8 тыс.4 часа назад
Problem Name: 2751. Robot Collisions Problem Statement: There are n 1-indexed robots, each having a position on a line, health, and movement direction. You are given 0-indexed integer arrays positions, healths, and a string directions (directions[i] is either 'L' for left or 'R' for right). All integers in positions are unique. All robots start moving on the line simultaneously at the same spee...
1717. Maximum Score From Removing Substrings | Leetcode Daily Challenge | DSA | Hindi
Просмотров 1,9 тыс.7 часов назад
Problem Name: 1717. Maximum Score From Removing Substrings Problem Statement: You are given a string s and two integers x and y. You can perform two types of operations any number of times. Remove substring "ab" and gain x points. For example, when removing "ab" from "cabxbae" it becomes "cxbae". Remove substring "ba" and gain y points. For example, when removing "ba" from "cabxbae" it becomes ...
1190. Reverse Substrings Between Each Pair of Parentheses | Leetcode Daily Challlenge | DSA | Hindi
Просмотров 2 тыс.12 часов назад
Problem Name: 1190. Reverse Substrings Between Each Pair of Parentheses Problem Statement: You are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting from the innermost one. Your result should not contain any brackets. Problem Link: leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses...
Lecture-8 127. Word Ladder | Graph Traversal | Graph Series | DSA | Hindi
Просмотров 22412 часов назад
Problem Name: 127. Word Ladder Problem Statement: A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord - s1 - s2 - ... - sk such that: Every adjacent pair of words differs by a single letter. Every si for 1 = i = k is in wordList. Note that beginWord does not need to be in wordList. sk endWord Given two words, beginWord and e...
1598. Crawler Log Folder | Leetcode Daily Challlenge | tree levels | DSA | Java | Hindi
Просмотров 1,5 тыс.14 часов назад
Problem Name: 1598. Crawler Log Folder Problem Statement: The Leetcode file system keeps a log each time some user performs a change folder operation. The operations are described below: "../" : Move to the parent folder of the current folder. (If you are already in the main folder, remain in the same folder). "./" : Remain in the same folder. "x/" : Move to the child folder named x (This folde...
Lecture-7 200. Number of Islands | Graph Traversal | Graph Series | DSA | Hindi
Просмотров 14214 часов назад
Problem Name: 200. Number of Islands Problem Statement: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Problem Link: leetcode.com/problems/number-of...
1701. Average Waiting Time | Leetcode Daily Challlenge | Arrays | DSA | Hindi
Просмотров 2 тыс.16 часов назад
Problem Name: 1701. Average Waiting Time Problem Statement: There is a restaurant with a single chef. You are given an array customers, where customers[i] = [arrivali, timei]: arrivali is the arrival time of the ith customer. The arrival times are sorted in non-decreasing order. timei is the time needed to prepare the order of the ith customer. When a customer arrives, he gives the chef his ord...
Lecture-6 733. Flood Fill using BFS and DFS | Graph Traversal | Graph Series | DSA | Hindi
Просмотров 15116 часов назад
Problem Name: 733. Flood Fill Problem Statement: An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and color. You should perform a flood fill on the image starting from the pixel image[sr][sc]. To perform a flood fill, consider the starting pixel, plus any pixels connected 4-directionally t...
1823. Find the Winner of the Circular Game | Leetcode Daily Challlenge | Maths | DSA | Hindi
Просмотров 1,8 тыс.19 часов назад
Problem Name: 1823. Find the Winner of the Circular Game Problem Statement: There are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More formally, moving clockwise from the ith friend brings you to the (i 1)th friend for 1 = i n, and moving clockwise from the nth friend brings you to the 1st friend. The rules of the game ...
1518. Water Bottles | Maths | leetcode daily challenge | DSA | Hindi
Просмотров 1,7 тыс.21 час назад
Problem Name: 1518. Water Bottles Problem Statement: There are numBottles water bottles that are initially full of water. You can exchange numExchange empty water bottles from the market with one full water bottle. The operation of drinking a full water bottle turns it into an empty bottle. Given the two integers numBottles and numExchange, return the maximum number of water bottles you can dri...
2582. Pass the Pillow | Maths | leetcode daily challenge | DSA | Hindi
Просмотров 1,9 тыс.День назад
Problem Name: 2582. Pass the Pillow Problem Statement: There are n people standing in a line labeled from 1 to n. The first person in the line is holding a pillow initially. Every second, the person holding the pillow passes it to the next person standing in the line. Once the pillow reaches the end of the line, the direction changes, and people continue passing the pillow in the opposite direc...
Lecture-5 Breadth First Search | BFS | Graph Traversal | Graph Series | DSA | Hindi
Просмотров 175День назад
Lecture-5 Breadth First Search | BFS | Graph Traversal | Graph Series | DSA | Hindi
2058. Find the Minimum and Maximum Number of Nodes Between Critical Points | DSA | Hindi
Просмотров 1,3 тыс.День назад
2058. Find the Minimum and Maximum Number of Nodes Between Critical Points | DSA | Hindi
Lecture-4 Depth First Search in Graph | DFS | Graph Traversal | Graph Series | DSA | Hindi | GFG
Просмотров 195День назад
Lecture-4 Depth First Search in Graph | DFS | Graph Traversal | Graph Series | DSA | Hindi | GFG
2181. Merge Nodes in Between Zeros Leetcode daily challenge | DSA | Hindi
Просмотров 1,3 тыс.День назад
2181. Merge Nodes in Between Zeros Leetcode daily challenge | DSA | Hindi
Lecture-3 Path | Cycle | DAG | Components Traversal | Graph Series | DSA | Hindi
Просмотров 161День назад
Lecture-3 Path | Cycle | DAG | Components Traversal | Graph Series | DSA | Hindi
1509. Minimum Difference Between Largest and Smallest Value in Three Moves Leetcode daily challenge
Просмотров 2,9 тыс.День назад
1509. Minimum Difference Between Largest and Smallest Value in Three Moves Leetcode daily challenge
Lecture-2 Graph Representation and Application | Graph Series | DSA | Hindi
Просмотров 429День назад
Lecture-2 Graph Representation and Application | Graph Series | DSA | Hindi
350. Intersection of Two Arrays II | hashing | leetcode daily challenge | DSA | Hindi
Просмотров 1,6 тыс.14 дней назад
350. Intersection of Two Arrays II | hashing | leetcode daily challenge | DSA | Hindi
Lecture-1 Introduction to Graphs | Graph Series | DSA | Hindi
Просмотров 61914 дней назад
Lecture-1 Introduction to Graphs | Graph Series | DSA | Hindi
1550. Three Consecutive Odds | linear search | sliding window | leetcode daily challenge | Hindi
Просмотров 1,2 тыс.14 дней назад
1550. Three Consecutive Odds | linear search | sliding window | leetcode daily challenge | Hindi
DSUs | Disjoint Sets in one shot | graph | leetcode daily challenge | DSA | Hindi
Просмотров 41314 дней назад
DSUs | Disjoint Sets in one shot | graph | leetcode daily challenge | DSA | Hindi
1579. Remove Max Number of Edges to Keep Graph Fully Traversable | graph | leetcode daily | Hindi
Просмотров 59314 дней назад
1579. Remove Max Number of Edges to Keep Graph Fully Traversable | graph | leetcode daily | Hindi
2192. All Ancestors of a Node in a Directed Acyclic Graph | graph | leetcode daily challenge | Hindi
Просмотров 76814 дней назад
2192. All Ancestors of a Node in a Directed Acyclic Graph | graph | leetcode daily challenge | Hindi
2285. Maximum Total Importance of Roads | graph | leetcode daily challenge | DSA | Hindi
Просмотров 1,3 тыс.14 дней назад
2285. Maximum Total Importance of Roads | graph | leetcode daily challenge | DSA | Hindi
1791. Find Center of Star Graph | graph | leetcode daily challenge | DSA | Hindi
Просмотров 80714 дней назад
1791. Find Center of Star Graph | graph | leetcode daily challenge | DSA | Hindi

Комментарии

  • @Aryabhatta_91
    @Aryabhatta_91 8 минут назад

    Can you join source code with it. As github repo or ss.

  • @saisree04
    @saisree04 Час назад

    Amazing and clear explanation as always

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo Час назад

    love from colombia❤

  • @shashwat_tiwari_st
    @shashwat_tiwari_st Час назад

    22:43 If anyone is thinking about the edge case where one of the target node is the ancestor... for cases where lca(p,q) = p or lca(p,q) = q. Path of one of the node will be "commonPath" and Path of second node will be "commonPath" + "some additional moves". Example: let's say p is the ancestor node. That means ancestor(p,q) = p. path from root to p is "LLRRLR" path from root to q is "LLRRLRLLRR" Now as you can see path of p is actually the prefix of path of q. Still our logic remains same, replace path of p with. "U" and add leftover path of q. So output will be "UUUUUULLRR".

  • @saket.01
    @saket.01 Час назад

    Started new journey

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 2 часа назад

    😍😍😍

  • @shashwat_tiwari_st
    @shashwat_tiwari_st 2 часа назад

    Please watch LCA before watching this video. Do like the video, if you understood the solution. Like target for this video is 100. ☺☺ ruclips.net/video/m9NKcTvrhSc/видео.html

  • @mr.nishantawasthi4402
    @mr.nishantawasthi4402 3 часа назад

    Nice

  • @gggg66669
    @gggg66669 3 часа назад

    thank you sir.

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh 5 часов назад

    Thanks 😊

  • @parthbhalerao3669
    @parthbhalerao3669 15 часов назад

    Huge Inspiration !! Please keep continuing.. I am an international student here in USA. I am highly benefited from your videos !!

  • @user-oi5ls4rs5g
    @user-oi5ls4rs5g 16 часов назад

    osm explain

  • @theritesh973
    @theritesh973 16 часов назад

    ❤❤❤

  • @nikhilchoudhari260
    @nikhilchoudhari260 17 часов назад

    Thank you sir.

  • @Pinncle-l2m
    @Pinncle-l2m 17 часов назад

    bro description is a 2-d array so iterating it should take O(n^2) . isn't it?

    • @i_do_what_i_like
      @i_do_what_i_like 15 часов назад

      Each element among n elements has 3 elements. So total traversal complexity is O(3*n) = O(n). It would have been n^2 if each element had n elements

  • @pritimurmu7898
    @pritimurmu7898 19 часов назад

    OMG this sol is great.Its so compact.Thank you so much.Also thankyou for doing it in java.Everyone does it in C++ and myself being only one doing DSA/CP in java...I struggle to find sol on youtube.Thank you so much!

    • @mathongo1940
      @mathongo1940 16 часов назад

      cp wale bhi solution search krte hai

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh 19 часов назад

    Thanks 😊

  • @nimado_9
    @nimado_9 19 часов назад

    Animal ek class and dog,cat, monkey these are objects

  • @Smarty_329
    @Smarty_329 21 час назад

    we are returning only root then how all others elements are printed ? can you explain please

    • @shashwat_tiwari_st
      @shashwat_tiwari_st 21 час назад

      @@Smarty_329 If you read the problem description, it is given that we only have to return the root of the new tree formed. They will traverse and check if it is correct or not (level order traversal). If you want to check, you can apply level order traversal and verify with outputs given in sample test cases..

  • @anandsinghrajput5846
    @anandsinghrajput5846 21 час назад

    Today 15 July 2024 i'll start the playlist.

  • @user-jq7gn6iv3e
    @user-jq7gn6iv3e 22 часа назад

    Keep Going 👌👌

  • @AmanSharma-fp5wk
    @AmanSharma-fp5wk День назад

    Thanks bhaiya 🙏

  • @SATYAMTIWARI-ps3wb
    @SATYAMTIWARI-ps3wb День назад

    Bhaiya ye wala lecture bahut complex hai samajh me nhi aaraha....

  • @shashwat_tiwari_st
    @shashwat_tiwari_st День назад

    If you have understood the explanation, please do like the video 😊. Like target for this video is 90

    • @starbawa5587
      @starbawa5587 22 часа назад

      Kya aap ek video main yeh bata sakte ho ki how younthink of a solution and how much actual time you take it would be helpfull

  • @user-oi5ls4rs5g
    @user-oi5ls4rs5g День назад

    gjb explain sir

  • @arneshbasak1910
    @arneshbasak1910 День назад

    Sir what is the space complexity?

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo День назад

    love from china❤

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd День назад

    first

  • @HarshThakur-bq9xo
    @HarshThakur-bq9xo День назад

    Best explanation!

  • @loneLeveling-Java
    @loneLeveling-Java День назад

    [1] Vegetables = class, Aloo, bhindi, Gajar=Objects, [2] Sweets=class, Kaju Katli, balMithai, rasgula, gulabjamun = objects :)

  • @mr.nishantawasthi4402
    @mr.nishantawasthi4402 День назад

    Great

  • @AKASHKUMAR-li7li
    @AKASHKUMAR-li7li День назад

    Thank you for explaining, i actually code in c++, i came here know the concept & implementation... and you save me♥♥

  • @shashwat_tiwari_st
    @shashwat_tiwari_st День назад

    Please do like, if you understood 😊. Like target for this video is 90

  • @neha886
    @neha886 День назад

    very nice explanantion sir,Thankyou

  • @theritesh973
    @theritesh973 День назад

    ❤❤❤

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh День назад

    Thanks 😊

  • @urbantech28
    @urbantech28 День назад

    bhai khatranaak mza aagya

  • @ranjankumarpatra135
    @ranjankumarpatra135 День назад

    wow what a content. Thank you so much sir❤❤❤❤

  • @StudentjatinJatin
    @StudentjatinJatin День назад

    bhaiya mana ya code c++ ma kiya to some test case pass ne ho ra ?..

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo День назад

    love from spain♥

    • @RohitKumar-dz8dh
      @RohitKumar-dz8dh День назад

      Whaa ka newspaper sach me cloth pe print hote hai ya rumour hai .

  • @krishnasrivaibhav2245
    @krishnasrivaibhav2245 День назад

    Respect for all those who came here after seeing the chemistry in a leet code question! Only Shashwat bhai can save us!

  • @bangaliconnection
    @bangaliconnection День назад

    What is the TC

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

    Sir wo remove substring "ab" and "ba" to get max point question ke video pe doubt comment Kiya haii.. Please sir solve krdo

    • @shashwat_tiwari_st
      @shashwat_tiwari_st День назад

      okay mai debug krke btata hu

    • @tejas2636
      @tejas2636 19 часов назад

      ​@@shashwat_tiwari_st Yes sir plz batao

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

    the best part is , you helping us think organically, thank you so much

  • @NiranjanMali-he5xo
    @NiranjanMali-he5xo 2 дня назад

    kuch smaj nahi aa raha haii

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

    Can you please take up the Leetcode 146. LRU Cache problem to explain in a video?

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

    Great you gained a sub

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

    not working for second case

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

      You might have missed something, check your code once more.

  • @PiyushYadav-pl9jm
    @PiyushYadav-pl9jm 2 дня назад

    We don't have to push any left moving robot to the stack. Also, We can just check at the start of the while loop that if the health of the left moving robot becomes 0 then we break out of the while loop.

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

      @@PiyushYadav-pl9jm That makes sense, I guess no changes in TC but it will reduce a few lines of code for sure.

    • @PiyushYadav-pl9jm
      @PiyushYadav-pl9jm 2 дня назад

      @shashwat_tiwari_st yeah, and thanks, btw

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

    Sir please update your version Yup study model like 1990s Git gaakar r1 r2 r3 bol rhe ho ye kya tarika hai