import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     *
     * @param nums int整型一维数组
     * @return int整型
     */
    public int remove_duplicates (int[] nums) {
        // write code here
        Set<Integer> set = new LinkedHashSet<>();
        for (int i = 0; i < nums.length; i++) {
            set.add(nums[i]);
        }
        return set.size();
    }
}

本题考察的知识点主要是寻找数组中不同元素个数,所用编程语言为java,我们可以采用集合进行元素添加,最后返回集合大小就行