leetcode Remove Duplicates from Sorted Array II
2015-10-22 19:39
337 查看
题目链接
思路:
没有
思路:
没有
public class Solution { public int removeDuplicates(int[] nums) { int length=1; boolean exist=false; int distance=0; for(int i=1;i<nums.length;i++) { if(nums[i-1-distance]==nums[i]) { if(exist) { distance++; continue; } else { exist=true; } } else { exist=false; } length++; nums[i-distance]=nums[i]; } return length; } }
相关文章推荐
- 计步器判断运动状态2
- 移动Web轮播图IOS卡顿的问题
- PPT演示快捷键
- Ubuntu14.04 安装jdk
- iOS开发系列--音频播放、录音、视频播放、拍照、视频录制
- UVA 10217 A Dinner with Schwarzenegger!!!
- UVA_11437_TriangleFun
- linux route命令学习
- 《设计模式》之策略模式
- XML的dom解析详解
- LeetCode题解——Happy Number
- RSS 2.0 php生成类,快读生成需要xml文件
- SPDY
- 通过开发者工具监控事件触发
- jdk7的新特性
- (笔记)Linux下system()函数的深度理解(整理)
- hdu5505
- 关于C#中的CompareTo使用方法
- ubuntu 中用vim打开txt等文件中文显示乱码的解决方法
- iOS开发拓展篇—音效的播放