iOS面试题:A、B两个int数组,得到A数组中B数组不包含的元素

96
iOS猿_员
2019.01.26 15:30* 字数 9

原文:iOS面试题大全

NSArray *arr1 = @[@1,@2,@3,@4,@5,@6,@7,@8];
NSArray *arr2 = @[@4,@5,@6,@7,@8,@9,@10,@11];
NSMutableArray *mArray = [NSMutableArray arrayWithCapacity:1];
for (int i=0; i<arr1.count; i++) {
    if (![arr2 containsObject:arr1[i]]) {
        [mArray addObject:arr1[i]];
    }
}
iOS面试题小集
Web note ad 1