随笔分类 - 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 <=
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:List<List<Integer>> res = new ArrayList<>();
阅读全文
摘要: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
阅读全文