最新 最热

Leetcode 69 Sqrt(x)

Implement int sqrt(int x). Compute and return the square root of x. 求x的平方根。 二分没什么好说的,注意INT_MAX溢出的情况!class Solution {public: int mySqrt(int x) { ......

2018-01-12
0

Leetcode 105 Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 根据先序和中序遍历还原二叉树。 思...

2018-01-12
2

Leetcode 112 Path Sum

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For exampl...

2018-01-12
1

Leetcode 129 Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which repre...

2018-01-12
1

Leetcode 257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / 2 3 5 All root-to-leaf paths are:["1-...

2018-01-12
1

[LeetCode] 129. Sum Root to Leaf Numbers

该文是关于二叉树的问题,给定一个代表数字的树,需要求出从根结点到叶子结点的所有路径的和。和Path Sum II类似,只不过需要累加的是每个路径代表的数字。通过递归的方式,对每个结点进行遍历,如果该结点有左右子结点,则递归...

2018-01-03
1

PTA 7-2 二叉搜索树的结构(30 分)

该文章介绍了如何通过编辑距离和相似度来判断两个字符串是否相等。编辑距离指的是将一个字符串转换成另一个字符串所需要的最小操作次数,这些操作包括插入、删除和替换。相似度指的是两个字符串之间的相似程度,可以用编...

2017-12-29
1