You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// nums 是以“引用”方式传递的。也就是说,不对实参做任何拷贝
int len = removeDuplicates(nums);
// 在函数里修改输入数组对于调用者是可见的。
// 根据你的函数返回的长度, 它会打印出数组中该长度范围内的所有元素。
for (int i = 0; i < len; i++) {
print(nums[i]);
}
习题
思路
定义变量记录前一项的值以及出现的次数,判断下一个值是否与前一个值一样以及出现的次数,如果超出要求则删除当前项,否则查看下一项。
解答
The text was updated successfully, but these errors were encountered: