题目描述 计算给定二叉树的所有左叶子之和。 示例: 题目链接: https://leetcode cn.com/problems/sum of left leaves/ 思路 一棵树的所有左叶子之和就是这棵树左子树的左叶子+右子树的左叶子。只有是左叶子才加进结果里,判断一个节点是否是左叶子的方法是根 ...
分类:
其他好文 时间:
2020-04-13 22:33:18
阅读次数:
67
地址:https://leetcode-cn.com/problems/missing-number/ <?php /** 给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。 示例 1: 输入: [3,0,1] 输出: 2 示例 2: ...
分类:
其他好文 时间:
2020-04-13 12:26:21
阅读次数:
85
地址:https://leetcode-cn.com/problems/move-zeroes/ <?php /** * Class Solution * 283. 移动零 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 示例: 输入: [0,1,0, ...
分类:
移动开发 时间:
2020-04-13 12:14:12
阅读次数:
78
此博客链接:https://www.cnblogs.com/ping2yingshi/p/12689658.html 删除聊表的第N个节点(34min) 题目链接:https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/ 给 ...
分类:
其他好文 时间:
2020-04-13 10:41:20
阅读次数:
58
题目描述 给定两个以字符串形式表示的非负整数 num1 和 num2,返回 num1 和 num2 的乘积,它们的乘积也表示为字符串形式。 示例: 题目链接: https://leetcode cn.com/problems/multiply strings/ 做这题之前可以先做一下 "字符串相加" ...
分类:
其他好文 时间:
2020-04-12 22:37:54
阅读次数:
66
120. 三角形最小路径和 给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。 例如,给定三角形: [ [2], [3,4], [6,5,7], [4,1,8,3] ] 自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。 class Soluti ...
分类:
其他好文 时间:
2020-04-12 20:21:28
阅读次数:
63
地址:https://leetcode cn.com/problems/binary tree preorder traversal/submissions/ 大意:前序遍历一棵树 ` ` ...
分类:
其他好文 时间:
2020-04-12 18:34:41
阅读次数:
64
题目描述 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 题目链接: https://leetcode cn.com/problems/longest common prefix/ 思路1 首先找到最短的字符串,然后遍历最短的字符串,将当前位和其余字符 ...
分类:
其他好文 时间:
2020-04-12 18:15:14
阅读次数:
58
此博客链接:https://www.cnblogs.com/ping2yingshi/p/12684896.html 移除重复节点(148min) 题目链接:https://leetcode-cn.com/problems/remove-duplicate-node-lcci/ 示例1: 输入:[1 ...
分类:
其他好文 时间:
2020-04-12 14:51:19
阅读次数:
84
题目: https://leetcode cn.com/problems/html entity parser/ 「HTML实体解析器」 是一种特殊的解析器,它将 HTML 代码作为输入,并用字符本身替换掉所有这些特殊的字符实体。 HTML 里这些特殊字符和它们对应的字符实体包括: 双引号:字符实体 ...
分类:
编程语言 时间:
2020-04-12 14:28:21
阅读次数:
63