摘要: 和26题Remove Duplicates from Sorted Array是一样的 1 public int removeElement(int[] nums, int val) { 2 if(nums == null || nums.length == 0) { 3 return 0; 4 } 阅读全文
posted @ 2016-02-02 05:02 warmland 阅读(103) 评论(0) 推荐(0)
摘要: 用一个cnt来记录有效的位置,遍历一边 1 public int removeDuplicates(int[] nums) { 2 if(nums == null || nums.length == 0) { 3 return 0; 4 } 5 int cnt = 1; 6 for(int i = 阅读全文
posted @ 2016-02-02 04:34 warmland 阅读(120) 评论(0) 推荐(0)