摘要: Example 1: Example 2: 使用57题作为method即可,注意parameters 阅读全文
posted @ 2019-02-21 14:22 Schwifty 阅读(119) 评论(0) 推荐(0)
摘要: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2019-02-21 13:28 Schwifty 阅读(138) 评论(0) 推荐(0)
摘要: 1. 0-1背包问题 https://www.cnblogs.com/toone/p/8554817.html 阅读全文
posted @ 2019-02-20 13:05 Schwifty 阅读(118) 评论(0) 推荐(0)
摘要: 当前的数目 = 同行上列 + 同列上行 回溯法把爷逗乐了,runtime爆炸。所以肯定是DP DP: 第一行和第一列的值只能是1,因为只有一种方法,第一行:向右,第一列:向下。 其余的,就是到达 (i , j) 的路径数 == 到达(i-1,j)的途径 + 到达(i,j-1)的途径。 还有种方法,是 阅读全文
posted @ 2019-02-20 07:58 Schwifty 阅读(108) 评论(0) 推荐(0)
摘要: 本博客所有随笔,code均来源于网络 说白了就是自己菜,想不出来,来源基本是算法珠玑,grandyang,等等等等 阅读全文
posted @ 2019-02-17 13:03 Schwifty 阅读(127) 评论(0) 推荐(0)
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2019-02-16 06:40 Schwifty 阅读(149) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/subsets/discuss/27281/A-general-approach-to-backtracking-questions-in-Java-(Subsets-Permutations-Combination-Sum-Palindr 阅读全文
posted @ 2019-02-13 05:34 Schwifty 阅读(147) 评论(0) 推荐(0)
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2019-02-08 12:32 Schwifty 阅读(122) 评论(0) 推荐(0)
摘要: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Example 2: 阅读全文
posted @ 2019-02-08 00:57 Schwifty 阅读(117) 评论(0) 推荐(0)
摘要: Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed int 阅读全文
posted @ 2019-02-07 13:57 Schwifty 阅读(139) 评论(0) 推荐(0)