菱纱梦

导航

2014年9月8日 #

Spiral Matrix II <leetcode>

摘要: Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri... 阅读全文

posted @ 2014-09-08 21:01 菱纱梦 阅读(153) 评论(0) 推荐(0) 编辑

Linked List Cycle II <leetcode>

摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?算法:... 阅读全文

posted @ 2014-09-08 20:29 菱纱梦 阅读(130) 评论(0) 推荐(0) 编辑

2014年9月7日 #

Binary Tree Postorder Traversal <leetcode>

摘要: Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No... 阅读全文

posted @ 2014-09-07 14:08 菱纱梦 阅读(176) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock III <leetcode>

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a... 阅读全文

posted @ 2014-09-07 13:21 菱纱梦 阅读(139) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock <leetcode>

摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文

posted @ 2014-09-07 12:26 菱纱梦 阅读(178) 评论(0) 推荐(0) 编辑

Search a 2D Matrix <leetcode>

摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文

posted @ 2014-09-07 10:32 菱纱梦 阅读(153) 评论(0) 推荐(0) 编辑

Minimum Path Sum <leetcode>

摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文

posted @ 2014-09-07 10:14 菱纱梦 阅读(158) 评论(0) 推荐(0) 编辑

2014年9月6日 #

Container With Most Water <leetcode>

摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文

posted @ 2014-09-06 22:36 菱纱梦 阅读(127) 评论(0) 推荐(0) 编辑

2014年9月3日 #

Binary Tree Level Order Traversal II <leetcode>

摘要: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For e... 阅读全文

posted @ 2014-09-03 20:48 菱纱梦 阅读(163) 评论(0) 推荐(0) 编辑

Rotate Image <leetcode>

摘要: You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?思路:首先左右翻转,然后按照左下,右上... 阅读全文

posted @ 2014-09-03 19:10 菱纱梦 阅读(133) 评论(0) 推荐(0) 编辑