摘要: I firstly solved this problem bruteforcely, the solution is easy, but the time complexity is O(n2): public int[] dailyTemperatures(int[] temperatures) 阅读全文
posted @ 2022-02-03 14:31 阳光明媚的菲越 阅读(26) 评论(0) 推荐(0) 编辑
摘要: This is a "palindromic" problem, I think DP can solve this problem, but there is a easier way to solve it, the time complexity is O(n2): private int r 阅读全文
posted @ 2022-02-03 10:32 阳光明媚的菲越 阅读(19) 评论(0) 推荐(0) 编辑
摘要: This is the similar problem with "31. Next Permutation", the differences are: 1. 31 don't care about whether the "next" is larger or not, but 556 care 阅读全文
posted @ 2022-02-03 08:01 阳光明媚的菲越 阅读(25) 评论(0) 推荐(0) 编辑
摘要: This problem can be resolved by two points, but the operation is pretty tricky: public List<List<Integer>> findRLEArray(int[][] encoded1, int[][] enco 阅读全文
posted @ 2022-02-03 07:53 阳光明媚的菲越 阅读(38) 评论(0) 推荐(0) 编辑
摘要: This is an absolutely math problem: 1. calculate minute angle: 360/60*minutes 2. calculate hour angle: 360/12*hour%12 3. calculate hour angle's plus, 阅读全文
posted @ 2022-02-03 04:28 阳光明媚的菲越 阅读(31) 评论(0) 推荐(0) 编辑
摘要: First I wrote a bruteforce solution, but it didn't pass because of too many calls, the time complexity is O(m*n): public int leftMostColumnWithOne(Bin 阅读全文
posted @ 2022-02-03 03:50 阳光明媚的菲越 阅读(31) 评论(0) 推荐(0) 编辑
摘要: This problem can be solved by sliding window: 1. firstly the right point, j, start to move, if it meet a zero, the zeroNum++, which means, we convert 阅读全文
posted @ 2022-02-03 03:03 阳光明媚的菲越 阅读(24) 评论(0) 推荐(0) 编辑
摘要: This is the typical DP problem, the time complexity is O(n2), Where n is the length of string s. This is due to the fact that we try to find result fo 阅读全文
posted @ 2022-02-03 00:47 阳光明媚的菲越 阅读(19) 评论(0) 推荐(0) 编辑