标签:
descriptions:
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
注意是有序数组。。
代码:
if(nums.length==0) return 0;
int flag=1;
for(int i=1;i<nums.length;i++){
if(nums[i-1]==nums[i])
{
continue;
}else{
nums[flag]=nums[i];
flag++;
}
}
return flag;
LeetCode-Remove Duplicates From Sorted Array
标签:
原文地址:http://www.cnblogs.com/hhhhh/p/4579090.html