1110. Delete Nodes And Return Forest Leetcode Editorial || Recursion + BFS Approach #code #leetcode
Complete Playlist: https://www.youtube.com/playlist?list=PLfdTvLFsiAwWzvcjeoNQs657sSAEi9Du_ Leetcode Problem Link: https://leetcode.com/problems/delete-nodes-and-return-forest/description/ Code: Recursion : https://leetcode.com/problems/delete-nodes-and-return-forest/solutions/5488506/recursion-code-best-video-solution-interview-ready-o-n-o-n-srajan-agrawal/ BFS Approach: https://leetcode.com/problems/delete-nodes-and-return-forest/solutions/5488498/bfs-approach-best-video-solution-o-n-o-n-srajan-agrawal/ Similar Problems: https://leetcode.com/problems/count-nodes-with-the-highest-score/ Problem Description: 1110. Delete Nodes And Return Forest Solved Medium Topics Companies Given the root of a binary tree, each node in the tree has a distinct value. After deleting all nodes with a value in to_delete, we are left with a forest (a disjoint union of trees). Return the roots of the trees in the remaining forest. You may return the result in any order. Example 1: Input: root = [1,2,3,4,5,6,7], to_delete = [3,5] Output: [[1,2,null,4],[6],[7]] Example 2: Input: root = [1,2,4,null,3], to_delete = [3] Output: [[1,2,4]] Constraints: The number of nodes in the given tree is at most 1000. Each node has a distinct value between 1 and 1000. to_delete.length = 1000 to_delete contains distinct values between 1 and 1000. Social Handles: LinkedIn: https://www.linkedin.com/in/srajan-agrawal-98459321a/ GitHub: https://github.com/SrajanAgrawal/ Search Using: 1110. Delete Nodes And Return Forest Delete Nodes And Return Forest Leetcode Leetcode Delete Nodes And Return Forest Leetcode Problem of the day Leetcode POTDs how to start leetcode coding for beginners leetcode for beginners Time Stamp: 0:00 Introduction: 0:30 Problem Description: 04:30 Build the Logic: 07:07 Explanation (Recursion): 18:00 Recursion Code: 29:02 Time & Space Complexity: 31:55 Iterative (BFS): 34:25 BFS Code: 41:20 Time & Space Complexity (Approach 2): 42:32 Conclusion & Next Step: #Coding, #Programming, #SoftwareDevelopment, #CodingTutorial, #LearntoCode, #JavaScript, #Python, #C++, #Java, #WebDevelopment, #FrontendDevelopment, #BackendDevelopment, #FullStackDevelopment, #CodingBootcamp, #CodingChallenges, #CodingInterview, #Algorithm, #DataStructures, #GitHub, #CodingTips, #LeetCode, #LeetCodeSolutions, #LeetCodeProblems, #LeetCodeChallenge, #LeetCodeInterview
Download
0 formatsNo download links available.