Remove Duplicates from Sorted Array
来源:互联网 发布:林彪为什么要叛变 知乎 编辑:程序博客网 时间:2024/04/30 14:02
Remove Duplicates from Sorted Array
public class Solution { public int removeDuplicates(int[] A) { boolean isEqual = false; int count = 0; int tmp = 0; if(A == null || A.length == 0){ return 0; } if(A.length == 1){ return 1; } for(int i = 1 ; i < A.length ; i++){ if(A[i] == A[i -1]){ count++; tmp++; isEqual = true; }else if(tmp > 0){ A[i - tmp] = A[i]; } }// for(int i = 0 ; i < A.length ; i++){// System.out.println(A[i]);// } return A.length - count; }}虽然是一道简单题目,但是可以做到1A也挺开心的,不过这道题记得之前做过,但是看MySubmisson里面却没有提交记录,用了看过的方法做的
0 0
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates From Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- Remove Duplicates from Sorted Array
- 开始coding生活了~~
- bootstrap框架学习笔记
- [心灵鸡汤]林清玄散文集
- 杭州聚集事件续:村民称秘密开工是导火索
- 设计模式系列课程13之【原型模式】
- Remove Duplicates from Sorted Array
- 免费图标下载
- md5.c
- 不容错过!开发者必备的十二大Android开发资源
- 自动根据控件排序布局
- jdbc连接java工程和Oracle数据库
- 中央审计在港央企 华润员工:有同事突然不见
- AspectJ切入点语法解析
- Spring Context