I have to write a method that takes an array of ints that is already sorted in numerical order then remove all the duplicate numbers and return an array of just the numbers
public int[] noDups(int[] arr){ int j = 0; // copy the items without the dups to res int[] res = new int[arr.length]; for(int i=0; i
First loop is O(n) and so is the second loop - which totals in O(n) as requested.
O(n)