Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cos;
- import java.util.*;
- import java.util.stream.Collectors;
- public class SPOJ {
- public static void main(String[] args) {
- List<Integer> liczby = new ArrayList<>();
- Scanner scanner = new Scanner(System.in);
- int ileLiczb = scanner.nextInt();
- for (int i = 0; i < ileLiczb; i++) {
- liczby.add(scanner.nextInt());
- }
- Collections.reverse(liczby);
- liczby = liczby.stream().distinct().collect(Collectors.toList());
- System.out.println(liczby);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement