leetcode刷题之路

1 已关注
92篇博文
• leetcode 刷题之路 92 Climbing Stairs

一个台阶总共有n级，如果一次可以跳1级，也可以跳2级，求总共有多少总跳法。

2014-08-16 20:46
982
• leetcode 刷题之路 91 Pascal's Triangle

Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, ...

2014-08-13 21:38
561
• leetcode 刷题之路 90 Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same colo...

2014-08-13 21:29
689
• leetcode 刷题之路 89 Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit. Give...

2014-08-13 17:11
635
• leetcode 刷题之路 88 Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and ret...

2014-08-13 16:36
560
• leetcode 刷题之路 87 Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2-...

2014-08-13 16:17
622
• leetcode 刷题之路 86 Balanced Binary Tree

Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced bina...

2014-08-13 15:55
542
• leetcode 刷题之路 85 Merge Two Sorted Lists

erge two sorted linked lists and return it as a new list. The new list should be made by splicing to...

2014-08-13 15:34
570
• leetcode 刷题之路 84 Single Number II

给定一个包含n个整数的数组，除了一个数出现一次外所有的整数均出现三次，找出这个只出现一次的整数。

2014-08-13 13:46
751
• leetcode 刷题之路 83 Maximum Subarray

思路：从左向右遍历数组元素相加求和得到和sum，若sum小于0，必然会对总的和有损耗，因此将sum重置为0，从当前位置继续重复上述过程，直到数组结束，与此同时设置max变量记录求和过程中遇到的最大值。...

2014-08-13 13:27
611
• leetcode 刷题之路 82 Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes gr...

2014-08-13 13:18
676
• leetcode 刷题之路 81 Populating Next Right Pointers in Each Node

Populate each next pointer to point to its next right node. 二叉树的结构体里增加了next指针，编写程序，将二叉树里每个节点的next指针...

2014-08-13 09:56
595
• leetcode 刷题报告 80 Single Number

Given an array of integers, every element appears twice except for one. Find that single one. Not...

2014-08-12 20:03
475
• leetcode 刷题之路 79 Binary Tree Preorder Traversal

非递归实现树的前序遍历

2014-08-12 15:01
656
• leetcode 刷题之路 78 Binary Tree Postorder Traversal

非递归方式实现二叉树的后序遍历。

2014-08-12 14:49
785
• leetcode 刷题之路 77 Permutations II

Given a collection of numbers that might contain duplicates, return all possible unique permutations...

2014-08-11 17:21
823
• leetcode 刷题之路 76 Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once. For ex...

2014-08-11 15:47
586
• leetcode 刷题之路 75 Plus One

Given a non-negative number represented as an array of digits, plus one to the number. The digits...

2014-08-10 19:25
749
• leetcode 刷题之路 74 Construct Binary Tree from Preorder and Inorder Traversal

Given preorder and inorder traversal of a tree, construct the binary tree. 从前序遍历结果和中序遍历结果中

2014-08-10 18:26
487
• leetcode 刷题之路 73 Best Time to Buy and Sell Stock III

Say you have an array for which the ith element is the price of a given stock on day i. Design an...

2014-08-10 17:55
567