9.3-微众银行-数据仓库-笔试

一、选择题

总计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();
        }
    }
}


第二题:挑选

要求按右筛选去重,我直接反转去重再反转,全都调用的API

import 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(' ');
        }
    }
}


全部评论
6
2 回复 分享
发布于 2023-09-04 10:50 湖南
跟我昨天做的题目一模一样,大数据的笔试题目都不换的吗
点赞 回复 分享
发布于 2023-09-14 16:03 广东
老哥收到面试消息了吗
点赞 回复 分享
发布于 2023-10-23 16:56 安徽

相关推荐

02-09 13:09
长安大学 Java
黑皮白袜臭脚体育生:简历条例统一按使用了什么技术实现了什么功能解决了什么问题或提升了什么性能指标来写 可以看看我帖子简历写法
点赞 评论 收藏
分享
就用这个吧:支持多益再加一个空气使用费
点赞 评论 收藏
分享
评论
7
17
分享

创作者周榜

更多
牛客网
牛客企业服务