Answer:
Step-by-step explanation:
The following code is written in Python. It takes in an array of numbers as a parameter and loops through it. It checks to see if each element is already inside the new_arr array and if not then it adds it. Finally, it prints out the new_arr, prints the new_arr size and returns new_arr to the user which contains all the numbers from the original array without the duplicates.
def removeDuplicates(arr):
new_arr = []
for element in arr:
if element not in new_arr:
new_arr.append(element)
print(new_arr)
print("New Array Size: " + str(len(new_arr)))
return new_arr
test_arr = [1, 4, 9, 16, 9, 7, 4, 9, 11]
removeDuplicates(test_arr)