2015年3月8日

Pascal's Triangle II

摘要: Pascal's Triangle II问题:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].思路: 简单的数学推理即可我的代码:public cla... 阅读全文

posted @ 2015-03-08 21:46 zhouzhou0615 阅读(140) 评论(0) 推荐(0) 编辑

Pascal's Triangle

摘要: Pascal's Triangle问题:GivennumRows, generate the firstnumRowsof Pascal's triangle.思路: 简单的数学推理我的代码:public class Solution { public List> generate(int ... 阅读全文

posted @ 2015-03-08 21:11 zhouzhou0615 阅读(154) 评论(0) 推荐(0) 编辑

Merge Sorted Array

摘要: 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 tha... 阅读全文

posted @ 2015-03-08 21:00 zhouzhou0615 阅读(122) 评论(0) 推荐(0) 编辑

Linked List Cycle II

摘要: Linked List Cycle II问题:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it withou... 阅读全文

posted @ 2015-03-08 20:42 zhouzhou0615 阅读(116) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted Array II

摘要: Remove Duplicates from Sorted Array II问题:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array ... 阅读全文

posted @ 2015-03-08 20:08 zhouzhou0615 阅读(118) 评论(0) 推荐(0) 编辑

Plus One

摘要: Plus One问题:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant ... 阅读全文

posted @ 2015-03-08 19:51 zhouzhou0615 阅读(125) 评论(0) 推荐(0) 编辑

Container With Most Water

摘要: Container With Most Water问题:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn suc... 阅读全文

posted @ 2015-03-08 19:41 zhouzhou0615 阅读(139) 评论(0) 推荐(0) 编辑

Search a 2D Matrix

摘要: Search a 2D Matrix问题:Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each ... 阅读全文

posted @ 2015-03-08 16:26 zhouzhou0615 阅读(178) 评论(0) 推荐(0) 编辑

Find Minimum in Rotated Sorted Array II

摘要: Find Minimum in Rotated Sorted Array II问题:Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-t... 阅读全文

posted @ 2015-03-08 15:59 zhouzhou0615 阅读(142) 评论(0) 推荐(0) 编辑

Search in Rotated Sorted Array II

摘要: Search in Rotated Sorted Array II问题:Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complex... 阅读全文

posted @ 2015-03-08 15:21 zhouzhou0615 阅读(147) 评论(0) 推荐(0) 编辑

Search in Rotated Sorted Array

摘要: Search in Rotated Sorted Array问题:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 ... 阅读全文

posted @ 2015-03-08 11:09 zhouzhou0615 阅读(155) 评论(0) 推荐(0) 编辑

Find Minimum in Rotated Sorted Array

摘要: Find Minimum in Rotated Sorted Array问题:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 ... 阅读全文

posted @ 2015-03-08 10:26 zhouzhou0615 阅读(133) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted Array

摘要: Remove Duplicates from Sorted Array问题:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new le... 阅读全文

posted @ 2015-03-08 09:53 zhouzhou0615 阅读(110) 评论(0) 推荐(0) 编辑

Spiral Matrix

摘要: Spiral Matrix问题:Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.思路: 矩阵螺旋访问模板我的代码:public class Soluti... 阅读全文

posted @ 2015-03-08 09:33 zhouzhou0615 阅读(157) 评论(0) 推荐(0) 编辑

导航