Given a sorted array of integers, write a function to remove any duplicates. Give algorithm, then code and finally list how you would test your program.
Anonymous
The easy way is to create a new array with the same size. Add only non repeating integer to the new array. Return new array in the end of loop For in place solution: loop through array compare n+1 with n create one reference idx and set idx = n loop through array from 0...n and n+1 < length of array if array[n+1] == array[idx], set array[n+1] == null else array[++idx] = array[n+1]
Check out your Company Bowl for anonymous work chats.