摘要: 216. Combination Sum III Find all valid combinations of k numbers that sum up to n such that the following conditions are true: Only numbers 1 through 阅读全文
posted @ 2022-10-15 01:57 BLUESociety 阅读(23) 评论(0) 推荐(0)
摘要: 回溯算法理论基础 回溯法也可以叫做回溯搜索法,它是一种搜索的方式。 回溯是递归的副产品,只要有递归就会有回溯。 回溯的本质是穷举,穷举所有可能,然后选出我们想要的答案,如果想让回溯法高效一些,可以加一些剪枝的操作,但也改不了回溯法就是穷举的本质。 回溯法,一般可以解决如下几种问题: 组合问题:N个数 阅读全文
posted @ 2022-10-14 03:59 BLUESociety 阅读(31) 评论(0) 推荐(0)
摘要: 669. Trim a Binary Search Tree Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all 阅读全文
posted @ 2022-10-13 01:29 BLUESociety 阅读(41) 评论(0) 推荐(0)
摘要: 235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in 阅读全文
posted @ 2022-10-12 05:14 BLUESociety 阅读(22) 评论(0) 推荐(0)
摘要: 530. Minimum Absolute Difference in BST Given the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any 阅读全文
posted @ 2022-10-11 04:07 BLUESociety 阅读(27) 评论(0) 推荐(0)
摘要: 654. Maximum Binary Tree You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the fo 阅读全文
posted @ 2022-10-11 02:57 BLUESociety 阅读(13) 评论(0) 推荐(0)
摘要: 513. Find Bottom Left Tree Value Given the root of a binary tree, return the leftmost value in the last row of the tree. Example 1: Input: root = [2,1 阅读全文
posted @ 2022-10-08 04:49 BLUESociety 阅读(53) 评论(0) 推荐(0)
摘要: 110. Balanced Binary Tree Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a bi 阅读全文
posted @ 2022-10-07 04:48 BLUESociety 阅读(12) 评论(0) 推荐(0)
摘要: 104. Maximum Depth of Binary Tree Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes alon 阅读全文
posted @ 2022-10-06 01:59 BLUESociety 阅读(1151) 评论(0) 推荐(0)
摘要: 102. Binary Tree Level Order Traversal Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to rig 阅读全文
posted @ 2022-10-05 02:04 BLUESociety 阅读(1253) 评论(0) 推荐(0)