摘要: class Solution { public ListNode deleteDuplicates(ListNode head) { ListNode pre=new ListNode(0); pre.next=head; ListNode p=pre; while(p!=null&&p.next!=null) ... 阅读全文
posted @ 2017-09-27 11:20 Weiyu Wang 阅读(98) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean search(int[] nums, int target) { if(nums.length==0) return false; int lo=0; int hi=nums.length-1; while(lonums[hi]) ... 阅读全文
posted @ 2017-09-27 11:10 Weiyu Wang 阅读(120) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int removeDuplicates(int[] nums) { if(nums.length nums[i-2]) nums[i++] = n; return i; } 阅读全文
posted @ 2017-09-27 05:30 Weiyu Wang 阅读(103) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean exist(char[][] board, String word) { if(board.length==0||board[0].length==0) return false; boolean[][] used=new boolean[board.length][b... 阅读全文
posted @ 2017-09-27 05:12 Weiyu Wang 阅读(146) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> subsets(int[] nums) { List> res=new ArrayList>(); subsets(0, new ArrayList(), res, nums); return res; } private void subsets(int idx,... 阅读全文
posted @ 2017-09-27 05:02 Weiyu Wang 阅读(164) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> combine(int n, int k) { List> res=new ArrayList>(); combine(n, k, new ArrayList(), res); return res; } private void combine(int num, ... 阅读全文
posted @ 2017-09-27 04:57 Weiyu Wang 阅读(136) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String minWindow(String s, String t) { boolean[] chs=new boolean[128]; int[] cnt=new int[128]; for(int i=0;i0&&r0) count--; ... 阅读全文
posted @ 2017-09-27 04:38 Weiyu Wang 阅读(122) 评论(0) 推荐(0) 编辑