Important and Useful links from all over the Leetcode

List of all good posts on Leetcode. Comment down whichever I am missing and I will add all of them here – DP for beginners by @wh0ami –[LIST –] Graph for beginners by @wh0ami –[LIST –] Sliding window for beginners by @wh0ami –[LIST –] DP Patterns by @aatalyk – Leetcode patterns from edu_cative_dot_io by @late_riser […]

Leetcode – 968 – Binary Tree Cameras

Given a binary tree, we install cameras on the nodes of the tree. Each camera at a node can monitor its parent, itself, and its immediate children. Calculate the minimum number of cameras needed to monitor all nodes of the tree. Example 1: Input: [0,0,null,0,0] Output: 1 Explanation: One camera is enough to monitor all nodes if placed […]

Leetcode 99 – Recover Binary Search Tree – Constant space

Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure with constant space. Example 1: Input: [1,3,null,null,2]   1   / 3   \   2 Output: [3,1,null,null,2]   3   / 1   \   2 Example 2: Input: [3,1,4,null,null,2] 3 / \ 1 4 […]