自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

freeliao的专栏 在路上奔跑。。。

热爱技术,热爱生活。

  • 博客(11)
  • 收藏
  • 关注

原创 leetcode-Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+",

2013-11-30 11:58:11 796

原创 leetcode-Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20

2013-11-28 20:25:46 728

原创 leetcode-Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解题的方法也是递归,以链表的中点为根节点,左边元素为根节点的左子树节点,右边元素为链表右子树节点,再对左边元素和右边元素递归操作。/** * Definition for

2013-11-28 20:06:09 935

原创 leetcode-Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.只要把数组中点的元素左边和右边的元素分开,把中点当做子树根节点,左边的元素是根节点左子树的节点,右边的元素是右子树的节点,递归操作即可。/** * Definition for binary tr

2013-11-28 19:38:53 760

原创 leetcode-Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.题目要找出根节点到叶子节点的最短距离。递归分治如下:/**

2013-11-28 19:20:03 791

原创 leetcode-Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","

2013-11-28 14:13:18 1261

原创 leetcode-Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.

2013-11-27 14:02:06 756

原创 leetcode-Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f

2013-11-26 19:25:30 1097

原创 leetcode-Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2013-11-24 20:20:39 1071

原创 leetcode-Insertion Sort List

Sort a linked list using insertion sort.对链表进行插入排序。方法一:按照传统插入排序方法,从第二个节点从最后一个节点,依次把节点插入到前面已排好序的链表中的正确位置。/** * Definition for singly-linked list. * struct ListNode { * int val; * Lis

2013-11-18 18:54:43 1055

原创 leetcode-Sort List

Sort a linked list in O(n log n) time using constant space complexity. http://oj.leetcode.com/problems/sort-list/    O (n log n)的排序算法有快速排序、归并排序等,于是一开始用快速排序算法:  /** * Definition for singly-lin

2013-11-18 10:43:11 1376

空空如也

空空如也

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

TA关注的人

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