摘要:
Note: 这道题很有意思,用的是二分法。想法是不停的试错。这个博客主把这个问题说的很清楚 https://xuezhashuati.blogspot.com/2017/03/lintcode-437-copy-books.html 其实二分法的方法可以变化的点很有限,最多变化的就是检查条件。一般难 阅读全文
摘要:
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or 阅读全文
摘要:
Given a sequence of integers, find the longest increasing subsequence (LIS). You code should return the length of the LIS. Given a sequence of integer 阅读全文
摘要:
方法一: 动态规划 https://segmentfault.com/a/1190000003768736 https://siddontang.gitbooks.io/leetcode-solution/content/dynamic_programming/perfect_squares.htm 阅读全文
摘要:
Note:From back to start, if A[distance] is larger than the distance to the last element, it indicates that the last element is reachable. We can move 阅读全文
摘要:
public class Solution { /** * @param n: An integer * @return: An integer */ public int climbStairs(int n) { // write your code here if (n == 0 || n == 1) { ... 阅读全文
摘要:
public class Solution { /** * @param grid: a list of lists of integers. * @return: An integer, minimizes the sum of all numbers along its path */ public int minPathSum(int[][] ... 阅读全文
摘要:
Important point:During the iniitialize, the top or left side, if one grid is BLOCK, the rest of those points are all blocked. 阅读全文
摘要:
Actually it can initial f[0][0] to 1, so that it can avoid a lot of coner checking. 阅读全文