Question: Given an array of positive integers, collapse the array to remove duplicates, and fill in the unused cells at the end with zeros. For example,
Given an array of positive integers, "collapse" the array to remove duplicates, and fill in the unused cells at the end with zeros. For example, given the array [5, 4, 5, 6, 4, 2], after this method executes the array should be [5, 4, 6, 2, 0, 0]. The method modifies the given array, and returns void.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
