![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
laohixdxm00
这个作者很懒,什么都没留下…
展开
-
31. Next Permutation
[brainstorm]1 find increase pair, swap the pair.the left number should be as close to the right boundary as possible.e.g.2 32 0 0 32 5 4 36 8 9 72 see more cases by full permutatione.g.1 2 31 3 22 1 33 1 23 2 1find some exceptional case,1 3原创 2021-05-30 11:56:05 · 142 阅读 · 0 评论 -
lc346
[bug]class MovingAverage { int sum; int sz; Deque<Integer> dq = new ArrayDeque<>(); /** Initialize your data structure here. */ public MovingAverage(int size) { this.sz = size; } public double next(i原创 2021-05-29 10:42:32 · 65 阅读 · 0 评论 -
lc844
[bug]class Solution { public boolean backspaceCompare(String s, String t) { int n1 = s.length(); int n2 = t.length(); int i1 = n1-1; int i2 = n2-1; char ch1=' '; char ch2=' '; int cnt1 = 0;原创 2021-05-29 10:41:39 · 66 阅读 · 0 评论 -
21. Merge Two Sorted Lists
https://leetcode-cn.com/problems/merge-two-sorted-lists/[bug]/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } * ListNode(int原创 2021-05-28 14:52:37 · 47 阅读 · 0 评论 -
45. Jump Game II
https://leetcode-cn.com/problems/jump-game-ii/[brainstorm]1 solution 1, timeout, hard to transfer to dp solution.why it is hard to transfer to dp solution?design:2 dp solution, can you see the bug?e.g. [2 3 1 1 4][3 1 1 4] is sub problem, so as [1原创 2021-05-27 23:46:29 · 35 阅读 · 0 评论 -
29. Divide Two Integers
https://leetcode-cn.com/problems/divide-two-integers/[wrong code]class Solution { public int divide(int dividend, int divisor) { if(dividend==0){ return 0; } if(dividend<0 && divisor<0){原创 2021-05-08 23:44:15 · 60 阅读 · 0 评论