Import java.util.ArrayList;
Import java.util.List;
Import Java.util.Scanner; /** * Small easy to have a length of n sequence, small easy to remove the inside of the repeating elements, but small easy to think is for each element to retain the last occurrence of that.
Small easy to meet difficulties, I hope you to help him. * * * * @author pomay * * * * */public class Wangyi_duplicate {public void Slove (int[] sequence) {//define a linked list to store the final result List
<Integer> list = new arraylist<integer> (); Iterate from the back to ensure that each element retains the last occurrence of the for (int i = sequence.length-1 i >= 0; i--) {//If there is no such number in the list, put in if (!list.contain
S (Sequence[i]) List.add (Sequence[i]); (int i = List.size ()-1; I >= 0; i--) {if (i > 0) System.out.print (list.get (i) + "")
;
Else System.out.print (List.get (i));
} public static void Main (string[] args) {//input includes two lines: Scanner s = new Scanner (system.in);
The first behavior sequence length n (1≤n≤50) int n = s.nextint ();
Second act n number sequence[i] (1≤sequence[i]≤1000), separated by a space int[] sequence = new Int[n];
for (int i = 0; i < n; i++) {Sequence[i] = S.nextint (); } wangyi_duplicate DuplicatE = new Wangyi_duplicate ();
Duplicate.slove (sequence);
}
}