摘要: Reverse digits of an integer. Returns 0 when the reversed integer overflows (signed 32-bit integer). Given x = 123, return 321 Given x = -123, return  阅读全文
posted @ 2016-03-06 10:16 哥布林工程师 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove the nth node from the end of list and return its head. Given linked list: 1->2->3->4->5->null, and n = 2. After removing t 阅读全文
posted @ 2016-03-06 10:00 哥布林工程师 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Given an array and a value, remove all occurrences of that value in place and return the new length. The order of elements can be changed, and the ele 阅读全文
posted @ 2016-03-06 09:53 哥布林工程师 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2 阅读全文
posted @ 2016-03-06 09:19 哥布林工程师 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2016-03-06 09:09 哥布林工程师 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 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 fo 阅读全文
posted @ 2016-03-06 07:47 哥布林工程师 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given a rotated sorted array, recover it to sorted array in-place. [4, 5, 1, 2, 3] -> [1, 2, 3, 4, 5] 方法挺诡异的,记住就好: 找到分界点,把左半边反转,把右半边反转,这时候整个数组就是从大到小排列 阅读全文
posted @ 2016-03-05 07:05 哥布林工程师 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Given an integers array A. Define B[i] = A[0] * ... * A[i-1] * A[i+1] * ... * A[n-1], calculate B WITHOUT divide operation. For A = [1, 2, 3], return  阅读全文
posted @ 2016-03-03 13:48 哥布林工程师 阅读(142) 评论(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 a 阅读全文
posted @ 2016-03-03 13:31 哥布林工程师 阅读(196) 评论(0) 推荐(0) 编辑
摘要: Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical o 阅读全文
posted @ 2016-03-03 13:02 哥布林工程师 阅读(134) 评论(0) 推荐(0) 编辑