- 博客(10)
- 资源 (4)
- 收藏
- 关注
原创 Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?这个for循环中的下标非常容易搞混,一定要区分清楚,到底固定哪一列,对于第二个for里面,i相当于常量
2014-03-15 21:19:55 591
原创 Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2014-03-15 12:50:19 677
原创 Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from
2014-03-15 00:15:09 546
原创 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 fo
2014-03-14 13:36:24 568
原创 Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new length.刚看到
2014-03-12 12:33:16 536
原创 Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?刚开始看到题目简单的写了个递归,提交超时。后来又仔细推演
2014-03-12 11:15:52 574
原创 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] ha
2014-03-12 10:46:28 3885
原创 Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.相比第一次写的代码,这次的看起来有点代码之
2014-03-11 13:08:21 604
原创 Best Time to Buy and Sell Stock II
Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as ma
2014-03-10 17:28:08 1250
转载 快速掌握一门语言的50%
http://blog.csdn.net/myan/article/details/3144661下面列到的这个学习提纲感觉非常实用,按次不失为学习各种语言的一个捷径,所以记录如下:1. 首先了解该语言的基本数据类型,基本语法和主要语言构造,主要数学运算符和print函数的使用,达到能够写谭浩强程序设计书课后数学习题的程度;2. 其次掌握数组和其他集合类的使用,有基
2014-03-10 15:56:29 768
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人