随笔分类 -  Leetcode

摘要:1. 2 Keys Keyboard 先把dp的最小不走都设置为无穷大(Integer.MAX_VALUE),初始化条件:dp[0] = dp[1] = 0,状态转移方程为dp[i] = Math.min( dp[i] , dp[j] + i / j ), 1 < i < n + 1 , 1 <= 阅读全文
posted @ 2017-10-10 09:16 起床oO 阅读(150) 评论(0) 推荐(0)
摘要:636.Kth Largest Element in an Array 1.Problem Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted 阅读全文
posted @ 2017-08-24 14:46 起床oO 阅读(325) 评论(0) 推荐(0)
摘要:636. Exclusive Time of Functions 1.Problem Given the running logs of n functions that are executed in a nonpreemptive single threaded CPU, find the ex 阅读全文
posted @ 2017-08-24 14:01 起床oO 阅读(176) 评论(0) 推荐(0)
摘要:645. Set Mismatch 1.Problem The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set 阅读全文
posted @ 2017-08-23 15:29 起床oO 阅读(305) 评论(0) 推荐(0)
摘要:611. Valid Triangle Number 1.Problem Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the ar 阅读全文
posted @ 2017-08-22 15:17 起床oO 阅读(154) 评论(0) 推荐(0)
摘要:List<List<Integer>> res = new ArrayList<>(); 阅读全文
posted @ 2017-08-21 16:35 起床oO 阅读(180) 评论(0) 推荐(0)
摘要:39. Combination Sum 1.Problem Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used a 阅读全文
posted @ 2017-08-10 14:34 起床oO 阅读(279) 评论(0) 推荐(0)