Ad
  • Default User Avatar

    You can check whether an item exist or no in an array, by checking its index, so if the index ( == -1) OR in other way (< 0), it means that this item doesn't exist, so the logic here is to push this item to the output array.