2015年1月18日

摘要: 题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?代码:oj测试通过Runtime... 阅读全文
posted @ 2015-01-18 23:10 承续缘 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onl... 阅读全文
posted @ 2015-01-18 21:22 承续缘 阅读(323) 评论(0) 推荐(0) 编辑

2015年1月16日

摘要: 题目:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4... 阅读全文
posted @ 2015-01-16 23:15 承续缘 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 题目: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 digit is... 阅读全文
posted @ 2015-01-16 22:39 承续缘 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ... 阅读全文
posted @ 2015-01-16 22:08 承续缘 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space fo... 阅读全文
posted @ 2015-01-16 21:31 承续缘 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目: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 ... 阅读全文
posted @ 2015-01-16 20:58 承续缘 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing... 阅读全文
posted @ 2015-01-16 13:10 承续缘 阅读(224) 评论(0) 推荐(0) 编辑

2015年1月11日

摘要: 题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.代码:oj测试通过Runtime:178 ms 1 # Definition... 阅读全文
posted @ 2015-01-11 20:06 承续缘 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 题目:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep co... 阅读全文
posted @ 2015-01-11 16:13 承续缘 阅读(479) 评论(0) 推荐(0) 编辑

导航