01 2016 档案

摘要:题目链接 "https://leetcode.com/problems/remove duplicates from sorted array ii/" 题目原文 Follow up for "Remove Duplicates": What if duplicates are allow... 阅读全文
posted @ 2016-01-26 14:29 slurm 阅读(143) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/word search/" 题目原文 Given a 2D board and a word, find if the word exists in the grid. The word can be constru... 阅读全文
posted @ 2016-01-26 14:10 slurm 阅读(689) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/subsets/" 题目原文 Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subs... 阅读全文
posted @ 2016-01-26 13:46 slurm 阅读(384) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/combinations/" 题目原文 Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.... 阅读全文
posted @ 2016-01-26 13:38 slurm 阅读(492) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/minimum window substring/" 题目原文 Given a string S and a string T, find the minimum window in S which will cont... 阅读全文
posted @ 2016-01-26 13:24 slurm 阅读(611) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/sort colors/" 题目原文 Given an array with n objects colored red, white or blue, sort them so that objects of the... 阅读全文
posted @ 2016-01-15 11:07 slurm 阅读(194) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/search a 2d matrix/" 题目原文 Write an efficient algorithm that searches for a value in an m x n matrix. This mat... 阅读全文
posted @ 2016-01-15 10:46 slurm 阅读(253) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/set matrix zeroes/" 题目原文 Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it ... 阅读全文
posted @ 2016-01-14 17:22 slurm 阅读(203) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/edit distance/" 题目原文 Given two words word1 and word2, find the minimum number of steps required to convert wo... 阅读全文
posted @ 2016-01-14 17:04 slurm 阅读(236) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/simplify path/" 题目原文 Given an absolute path for a file (Unix style), simplify it. For example, path = , = p... 阅读全文
posted @ 2016-01-14 16:10 slurm 阅读(188) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/climbing stairs/" 题目原文 You are climbing a stair case. It takes n steps to reach to the top. Each time you can... 阅读全文
posted @ 2016-01-13 10:34 slurm 阅读(198) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/sqrtx/" 题目原文 Implement . Compute and return the square root of x. 题目大意 实现一个整型的开平方根 解题思路 使用牛顿迭代法进行求解 牛顿迭代... 阅读全文
posted @ 2016-01-13 10:20 slurm 阅读(450) 评论(0) 推荐(0)
摘要:题目链接 "https://leetcode.com/problems/text justification/" 题目原文 Given an array of words and a length L, format the text such that each line has exa... 阅读全文
posted @ 2016-01-12 17:10 slurm 阅读(487) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/add-binary/题目大意:给定两个二进制字符串,返回它们的和解题思路:模拟二进制竖式加法class Solution(object): def addBinary(self, a, b): """ ... 阅读全文
posted @ 2016-01-12 16:08 slurm 阅读(246) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/plus-one/题目大意:用一个digit数组表示一个非负整数,加1后返回这个数组 例如:[9,9]加1返回[1,0,0]解题思路:从后往前遍历,一次判断进位即可;注意计算到最高位的时候是否有进位的处理class Solu... 阅读全文
posted @ 2016-01-12 15:50 slurm 阅读(273) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/valid-number/题目大意:给定一个字符串,判断是否是数字 如:"0"=>true " 0.1 "=>true "abc"=>false "1 a"=>false "2e10"=... 阅读全文
posted @ 2016-01-07 16:47 slurm 阅读(617) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/minimum-path-sum/题目大意:在矩阵mxn中找到一条从(0,0)到(m,n)的路径,使得这条路径经过的点的总和最小,并返回这个值解题思路:同样可以使用DP进行求解,用a[i][j]表示从(0,0)到(m,n)的所有路... 阅读全文
posted @ 2016-01-07 16:22 slurm 阅读(200) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/unique-paths-ii/题目大意:给定mxn的矩阵,0表示可以通过,1表示不可以通过,返回从(0,0)到(m,n)一共有多少种走法解题思路:考虑使用DP,给定一个矩阵a[i][j]表示从(0,0)到(i,j)共有多少种走法... 阅读全文
posted @ 2016-01-07 16:06 slurm 阅读(213) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/unique-paths/题目大意:给定n、m,在mxn的矩阵中,从(0,0)走到(m-1,n-1)一共有多少种法(只能往下和往右走)解题思路:从(0,0)到(m-1,n-1)一共要走m - 1次向下,n-1次向右。也就是在n +... 阅读全文
posted @ 2016-01-07 15:48 slurm 阅读(227) 评论(0) 推荐(0)
摘要:题目链接:https://leetcode.com/problems/rotate-list/题目大意:链表向右旋转K位解题思路:链表操作,注意的是k有可能比链表长度要长,要将k mod 链表的长度代码(python): 1 # Definition for singly-linked list. ... 阅读全文
posted @ 2016-01-07 15:24 slurm 阅读(314) 评论(0) 推荐(0)