leetcode
花大师
不要假装很努力,结果不会陪你演戏!
展开
-
力扣120题-三角形最小路径之和
地址:https://leetcode-cn.com/problems/triangle/ 给出的数组: [ [2], [3,4], [6,5,7], [4,1,8,3] ] 这道题主要是查找从上到下最短的路径只和,注意是【和】,那么我们是不是可以自顶向下或者自下而上的对n层中对每个元素与n+1层的元素求和,然后取最小赋值给n的那个元素即可。 class Solution { /** * @param Integer[][] $triangle原创 2020-07-15 09:02:20 · 206 阅读 · 0 评论 -
力扣-112题-路径之和
地址:https://leetcode-cn.com/problems/path-sum/ java版 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { publi原创 2020-07-07 20:14:31 · 213 阅读 · 0 评论 -
leetcode-108题-将有序数组转换为二叉搜索树
https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/ <?php class TreeNode { public $val = null; public $left = null; public $right = null; function __construct($value) { $this->val = $value; } }.原创 2020-07-04 11:28:23 · 98 阅读 · 0 评论 -
leetcode-590、589题
https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/submissions/ 在构造数据上花费了功夫。 <?php class Node{ public $val = null; public $children = null; function __construct($val = 0){ $this->val = $val; $this->children = array(); } }原创 2020-07-04 10:50:46 · 153 阅读 · 0 评论