摘要: class Solution { public int maxProfit(int k, int[] prices) { int n = prices.length; if(n < 2) return 0; if(k >= n) { int res = 0; for(int i = 1; i < n 阅读全文
posted @ 2020-07-19 15:39 Sexyomaru 阅读(99) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List<Integer> getRow(int rowIndex) { Integer[] res = new Integer[rowIndex+1]; Arrays.fill(res,1); for(int i = 1; i <= rowIndex 阅读全文
posted @ 2020-07-19 14:49 Sexyomaru 阅读(108) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int numDistinct(String s, String t) { int m = s.length(), n = t.length(); int[][] dp = new int[m+1][n+1]; // dp[i][j]表示s前i个包含t 阅读全文
posted @ 2020-07-19 14:23 Sexyomaru 阅读(81) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int maxCoins(int[] nums) { int n = nums.length + 2; int[] points = new int[n]; points[0] = 1; points[n-1] = 1; for(int i = 1; 阅读全文
posted @ 2020-07-19 13:33 Sexyomaru 阅读(127) 评论(0) 推荐(0) 编辑