自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 收藏
  • 关注

原创 LeetCode:Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. 给出一个整型数组,其中除了一个元素之外,其他元素均出现两次,要求找出这个只出

2017-03-25 23:19:10 414

原创 LeetCode:3Sum

描述Given an arrayS ofn integers, are there elementsa,b,c inS such thata+b+c= 0? Find all uniquetriplets in the array which gives the sum of zero.Note:• Elements in a triplet (a, b, c)

2017-03-20 10:22:48 263

原创 LeetCode:Two Sum

描述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target,w

2017-03-11 23:22:10 243

原创 LeetCode:反转二叉树

解题思路: 要对一棵二叉树进行反转操作,则必须对其遍历,考虑使用先序遍历的方法,则先遍历根节点,接着对其左右孩子节点进行反转,再递归对以其左右孩子节点为根节点的子树进行反转操作,最终完成整棵二叉树的反转。需注意的点:所传根节点可能为0,即改树为空树,则应该作特殊处理,否则当取其左右孩子的时候会出现空指针异常。代码如下:/** * Definition for a binary tre

2017-03-05 22:04:23 582

原创 LeetCode:求二叉树的深度

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.二叉树的深度定义为根节点到距离根节点最远的叶子节点之间节点的数量。

2017-03-04 23:21:08 448

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除