摘要: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2016-06-22 23:49 欠扁的小篮子 阅读(1199) 评论(1) 推荐(0) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2, 阅读全文
posted @ 2016-06-22 23:28 欠扁的小篮子 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2016-06-22 22:42 欠扁的小篮子 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space. 判断一个整数是否是回文数。 思路:求出数字abcd的逆序的数值dcba,如果是回文数的话,那么abcd==dcba。 时间复杂度:O(n) pytho 阅读全文
posted @ 2016-06-22 22:12 欠扁的小篮子 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex 阅读全文
posted @ 2016-06-22 22:01 欠扁的小篮子 阅读(239) 评论(0) 推荐(0) 编辑