数组内移出目标元素,返回移除后的数组内容数目
-(NSInteger)removeElementInArray:(NSMutableArray <NSNumber *> *)array Target:(NSInteger)target
{
int length = 0;
for (int i=0; i<array.count; i++) {
if (array[i].integerValue != target) {
array[length ++] = array[i];
}
}
if (array.count > length) {
[array removeObjectsInRange:NSMakeRange(length, array.count - length)];
}
return length;
}