可以使用Python语言解决该问题,具体步骤如下:
def is_elements_in_another_array(array1, array2): for element in array1: is_in_array2 = False for item in array2: if element == item: is_in_array2 = True break if not is_in_array2: return False return True
array1 = [1, 2, 3, 4] array2 = [2, 3, 1, 5, 4] print(is_elements_in_another_array(array1, array2)) # True
array1 = [1, 2, 3, 4] array2 = [2, 3, 5, 4] print(is_elements_in_another_array(array1, array2)) # False
上一篇:Bingo号码类:接收错误
下一篇:并排打印列表