2021年8月3日
摘要:
Code link: https://leetcode.com/problems/check-completeness-of-a-binary-tree/ Constraint: In a complete binary tree, every level, except possibly the
阅读全文
posted @ 2021-08-03 23:47
blackraven25
阅读(25)
推荐(0)
2021年8月2日
摘要:
Code link: https://leetcode.com/problems/is-graph-bipartite/ Constraint: graph.length == n 1 <= n <= 100 0 <= graph[u].length < n 0 <= graph[u][i] <=
阅读全文
posted @ 2021-08-02 01:44
blackraven25
阅读(25)
推荐(0)
2021年8月1日
摘要:
Code link: Idea We can do a BSF against the tree with a queue. The key here is to ensure all the nodes within the same level are added to the same lis
阅读全文
posted @ 2021-08-01 22:41
blackraven25
阅读(28)
推荐(0)
2021年7月31日
摘要:
Code link: https://leetcode.com/problems/kth-largest-element-in-an-array/ Constraint: 1 ⇐ k ⇐ nums.length ⇐ 104 -104 ⇐ nums[i] ⇐ 104 Idea With the hel
阅读全文
posted @ 2021-07-31 23:32
blackraven25
阅读(24)
推荐(0)
摘要:
Code link: https://leetcode.com/problems/validate-binary-search-tree/ Constraint: The number of nodes in the tree is in the range [1, 104]. -231 ⇐ Nod
阅读全文
posted @ 2021-07-31 01:34
blackraven25
阅读(38)
推荐(0)
2021年7月30日
摘要:
Code link: https://leetcode.com/problems/same-tree/ Recursive solution: class Solution { public boolean isSameTree(TreeNode p, TreeNode q) { if (p ==
阅读全文
posted @ 2021-07-30 01:44
blackraven25
阅读(16)
推荐(0)
2021年7月29日
摘要:
Code link: https://leetcode.com/problems/symmetric-tree/ Recursive solution class Solution { public boolean isSymmetric(TreeNode root) { if (root == n
阅读全文
posted @ 2021-07-29 23:45
blackraven25
阅读(31)
推荐(0)
摘要:
Code link: https://leetcode.com/problems/balanced-binary-tree/ Constraint: The number of nodes in the tree is in the range [0, 5000]. This means we ca
阅读全文
posted @ 2021-07-29 01:59
blackraven25
阅读(20)
推荐(0)
2021年7月27日
摘要:
Problem link: https://leetcode.com/problems/binary-tree-postorder-traversal/ Constraint: Idea: We could do it either in recursive or iterative way. Co
阅读全文
posted @ 2021-07-27 23:45
blackraven25
阅读(29)
推荐(0)
摘要:
Problem link: https://leetcode.com/problems/binary-tree-preorder-traversal/ Ideas We could do it in either iterative or recursive way. Code Recursive
阅读全文
posted @ 2021-07-27 22:38
blackraven25
阅读(35)
推荐(0)