as we mentioned before, the binary search idea can happens almost anywhere, like implement pow(x, n) function and search rotated array, and many other unexpected, not so explicit senerio. we need to dig deeper to that binary search, and especially, the boundary problems, those are really p...
After a lot of practice in LeetCode, I've made a powerful binary search template and solved many Hard problems by just slightly twisting this template. I'll share the template with you guys in this post.I don't want to just show off the code and leave. Most importantly, I want to s...
This repository contains the solutions and explanations to the algorithm problems on LeetCode. Only medium or above are included. All are written in C++/Python and implemented by myself. The problems attempted multiple times are labelled with hyperlinks.
Since free questions may be even mistakenly taken down by some companies, only solutions will be posted on now. Hope you enjoy the journey of learning data structures and algorithms. Notes: "🔒" means your subscription of LeetCode premium membership is required for reading the question. Algorit...
In our previous article, available on this link, I introduced 10 powerful patterns that can help solve a wide variety of LeetCode problems efficiently. These patterns, including Two Pointers, Sliding Window, Binary Search, Depth-First Search, and Breadth-First Search, provide a structured approach...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
360 sort transformed array: two pointers, but this time, based on the relative value of function(i) and function(j) we move different pointer each time. 424: longest repeating character replacement: the general idea is pretty simple, but have so many details to care about. ...
Let’s check this one: https://leetcode.com/problems/same-tree/ As we can see, we already have a class TreeNode (we are near the topic, yes). public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val = val; } TreeNode(int...
K-th smallest element in a Binary Search Tree Level order traversal in spiral form Maximum path sum in a binary tree Preorder to Postorder of BST Check Mirror in N-ary Tree Count Number of Nodes in a Complete Binary Tree (Leetcode Problem Solution) ...
UseGoogle & well-known Morass blogthen??? (LeetCode problems tend to be on the easier side, but whatever) LeetCodeLeetCodeLeetCode Codeforces Stuff CFCF And that should be more than enough lmao...stop asking and start DOING →Reply