一、选择题总计20道408内容+大数据相关有单选,也有多选二、编程题两道很简单,第一次笔试AK第一题:随机播放器直接用queue搞定import java.util.LinkedList;import java.util.Queue;import java.util.Scanner;public class Main {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        int n = sc.nextInt();        Queue<Long> queue1 = new LinkedList<> ();        for(int i=1;i<=n;i++){            queue1.offer(sc.nextLong());        }        while (queue1.size()!=0){            //先出一个 并删除            System.out.print(queue1.poll());            System.out.print(' ');            queue1.offer(queue1.peek());            queue1.poll();        }    }}第二题:挑选要求按右筛选去重,我直接反转去重再反转,全都调用的APIimport java.util.*;public class Main {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        int n = sc.nextInt();        ArrayList<Integer> arr = new ArrayList<Integer>();        for(int i=1;i<=n;i++){            arr.add(sc.nextInt());        }        //反转        Collections.reverse(arr);        //去重 不排序        LinkedHashSet<Integer> set = new LinkedHashSet<Integer>(arr);        ArrayList<Integer> ans = new ArrayList<Integer>(set);        //再反转        Collections.reverse(ans);        for(int i=0;i<ans.size();i++){            System.out.print(ans.get(i));            System.out.print(' ');        }    }}
点赞 7
评论 3
全部评论

相关推荐

06-10 18:55
已编辑
西安电子科技大学 Java
只管努力就好:恭喜恭喜恭喜,我都没有面试机会,上周被压力炸了,今天中午看页面显示被捞进入评估结果下午就没了
京东三面373人在聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务