[LeetCode] Remove Nth Node From End of List 解题报告

摘要: Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After ... 阅读全文
posted @ 2012-12-31 14:01 小刀初试 阅读(136) 评论(0) 推荐(0)

[LeetCode] 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 mat... 阅读全文
posted @ 2012-12-31 12:54 小刀初试 阅读(79) 评论(0) 推荐(0)

[LeetCode] 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, ... 阅读全文
posted @ 2012-12-31 12:19 小刀初试 阅读(133) 评论(0) 推荐(0)

[LeetCode] Remove Duplicates from Sorted Array II 解题报告

摘要: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should r... 阅读全文
posted @ 2012-12-31 12:00 小刀初试 阅读(126) 评论(0) 推荐(0)

[LeetCode] Remove Duplicates from Sorted Array 解题报告

摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for... 阅读全文
posted @ 2012-12-31 11:44 小刀初试 阅读(151) 评论(0) 推荐(0)

[LeetCode] Pow(x, n) 解题报告

摘要: Implement pow(x, n).» Solve this problem[解题思路]二分法,注意n<0的情况。[Code]1: double power(double x, int n) 2: { 3: if (n == 0) 4: return... 阅读全文
posted @ 2012-12-31 11:19 小刀初试 阅读(104) 评论(0) 推荐(0)

[LeetCode] Recover Binary Search Tree 解题报告

摘要: Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2012-12-31 09:46 小刀初试 阅读(102) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示