摘要: Pascal's Triangle IIGiven an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your alg... 阅读全文
posted @ 2015-09-27 19:45 `Liok 阅读(307) 评论(0) 推荐(0) 编辑
摘要: Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,... 阅读全文
posted @ 2015-09-27 19:41 `Liok 阅读(348) 评论(0) 推荐(0) 编辑
摘要: House Robber IINote:This is an extension ofHouse Robber.After robbing those houses on that street, the thief has found himself a new place for his thi... 阅读全文
posted @ 2015-09-27 17:29 `Liok 阅读(232) 评论(0) 推荐(0) 编辑
摘要: House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint... 阅读全文
posted @ 2015-09-27 17:14 `Liok 阅读(299) 评论(0) 推荐(0) 编辑
摘要: Spiral Matrix IIGiven an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the... 阅读全文
posted @ 2015-09-27 16:06 `Liok 阅读(402) 评论(0) 推荐(0) 编辑
摘要: Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[... 阅读全文
posted @ 2015-09-27 15:55 `Liok 阅读(498) 评论(0) 推荐(0) 编辑
摘要: Peeking IteratorGiven an Iterator class interface with methods:next()andhasNext(), design and implement a PeekingIterator that support thepeek()operat... 阅读全文
posted @ 2015-09-27 14:31 `Liok 阅读(505) 评论(0) 推荐(0) 编辑