摘要:
I firstly solved this problem bruteforcely, the solution is easy, but the time complexity is O(n2): public int[] dailyTemperatures(int[] temperatures) 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
This problem can be resolved by two points, but the operation is pretty tricky: public List<List<Integer>> findRLEArray(int[][] encoded1, int[][] enco 阅读全文
摘要:
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, 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文