中国民生银行信用卡中心金融科技挑战赛数据算法赛道面经

TimeLine:线上初赛202208??,线下复赛20220822-20220826

当时的BG:北邮本硕,管理类专业,两段实习经历:字节数据分析师、美团商业分析师

写在前面的话:以下问题的答案必然存在错误,敬请读者批评指正

线上初赛

主要考察算法和SQL,算法的难度不是特别高,但SQL有一定难度

民生银行卡中心的代码平台仅有上传功能,并不是OJ,因此只能在本地进行样例测试

初试没有屏幕监控,因此理论上可求助于任何渠道(划掉)

算法题

1.

题目描述:

输入格式:

输出格式:

input_nums = []
while True:
    inputing = int(input())
    if inputing == -1:
        break
    else:
        input_nums.append(inputing)

res = [0] * len(input_nums)

for index in range(len(input_nums)):
    for i in range(1, input_nums[index] + 1):
        res[index] += input_nums[index]//i * i
        
for num in res:
    print(num)
input_nums = []
while True:
    inputing = int(input())
    if inputing == -1:
        break
    else:
        input_nums.append(inputing)

res = [0] * len(input_nums)

for index in range(len(input_nums)):
    for i in range(1, input_nums[index] + 1):
        tmp = []
        for j in range(1, int(i ** 0.5) + 1):
            if i % j == 0:
                tmp.append(j)
                tmp.append(int(i/j))
        res[index] += sum(set(tmp))
        
for num in res:
    print(num)

2.

题目描述:

输入格式:

输出格式:

def isprime(x):
    if x < 2:
        return False
    for i in range(2, int(x ** 0.5) + 1):
        if x % i == 0:
            return False
    return True

input_nums = []
while True:
    inputing = int(input())
    if inputing == -1:
        break
    else:
        input_nums.append(inputing)

res = [0] * len(input_nums)

for index in range(len(input_nums)):
    for i in range(1, input_nums[index] + 1):
        tmp = []
        if (int(str(i)) != int(str(i)[::-1])) and isprime(i) and isprime(int(str(i)[::-1])):
            tmp.append(i)
        res[index] += sum(tmp)

for num in res:
    print(num)

3.

题目描述:

输入格式:

输出格式:

input_nums = []
while True:
    inputing = int(input())
    if inputing == -1:
        break
    else:
        input_nums.append(inputing)

res = [0] * len(input_nums)

for index in range(len(input_nums)):
    for i in range(1, input_nums[index] + 1):
        res[index] += str(i).count('2')

for num in res:
    print(num)

SQL题

注:SQL题在本地不好测试,因此以下代码仅提供思路上的参考

1.

数据表详情如下:

数据表示例性字段如下:

问题1:请用sql查询语句,给出login_day中不同日期的种类个数以及最大日期和最小日期是什么?

select
count(login_day) as '日期种类',
max(login_day) as '最大日期',
min(login_day) as '最小日期'
from app_data
group by login_day

问题2:连登次数是指连续登录success且没有出现timeout或fail,login_day不需要连续。请写一段sql语句来计算每个客户最多的连登次数,结果以client_id升序排列

with a as
(
    select client_id,
    login_day,
    result,
    lead(client_id, 1) over(partition by client_id order by login_day) as next_result
    from app_data
)
select client_id,
count(result) as '次数'
from a
where result = 'success' and next_result = 'success'
group by client_id
order by client_id asc

问题3:请用sql语句来计算每个客户最多的连续非fai的次数(login_day不需连续),结果以client_id升序排列

with a as
(
    select client_id,
    login_day,
    result,
    lead(client_id, 1) over(partition by client_id order by login_day) as next_result
    from app_data
)
select client_id,
count(result) as '最多连续非fail次数'
from a
where result != 'fail' and next_result != 'fail'
group by client_id
order by client_id asc

问题4:连续登录是指login_day连续不间断。请写出一段sql语句来计算每个客户连续登录success大于等于4天的次数,结果以client_id升序排列

with a as
(
    select client_id,
    login_day,
    result,
    lead(client_id, 1) over(partition by client_id order by login_day) as next_result
    from app_data
)
select client_id,
count(result) as '次数'
from a
where result = 'success' and next_result = 'success'
group by client_id
having count(result) >= 4
order by client_id asc

2.

数据表详情如下:

数据表示例性字段如下:

问题1:请用sql语句计算首次交易后第二天再次交易的用户的比率,四舍五入到小数点后两位

with a as
(
    select client_id, trans_day,
    row_number() over(partition by client_id order by trans_day asc) as rn,
    date_sub(trans_day, interval rn day) as sub
    from trans_data
    where rn in (1, 2)
)
select round(count(client_id) / (select count(client_id) from trans_data group by client_id), 2) as Ratio
from a
group by client_id
having count(distinct sub) = 1

问题2:请用sql语句查询每个客户最近一次交易的amount,将amount按降序排列并给出前20行

with a as
(
    select client_id,
    trans_day, amount,
    row_number() over(partition by client_id order by trans_day desc) as rn
    from trans_data
)
select client_id, trans_day as '最近交易日期', amount
from a
where rn = 1
order by amount desc
limit 20

线下复赛

共有40名同学进入线下复赛环节,其中研发赛道20名,数据算法赛道20名

每5人为1个小组,因此数据算法赛道共有4支队伍,每两支队伍共享一个复赛题目,题目内容与银行风控有关

每支队伍需要在给定时间内,根据复赛的试题材料,进行线上打榜比赛,并制作PPT回答材料相关问题

复赛时间为5天,较招行夏令营而言相对不那么累,奖励较为丰厚,有一半的队伍可获得数目不菲的奖金,因此相当推荐大家参与

#银行招聘##民生银行##数据分析#
全部评论
线上初赛的时候限时吗?感觉好难啊。
点赞 回复 分享
发布于 2023-03-27 18:48 辽宁
请问初赛有时间限制嘛?另外复赛名次靠前是否有秋招直通终面等奖励呢
点赞 回复 分享
发布于 2023-03-22 12:30 上海

相关推荐

2025-12-02 02:15
门头沟学院
最近菊厂陆续开了,极力劝退那些拿13级的985硕士,就13级那么点儿薪资,一线城市每个月到手1.8/7/6w,租房2k还是破烂,吃饭2k还是预制菜,买个1k衣服都是聚酯纤维破塑料,稍微出去浪一浪,能留1w就是万岁,要是再有个啥都想买的对象,一线工作一年难存10w。隔壁工地混泥土,钳工,焊工一天800+,还包吃包住。读书18年到985硕士出来就为了进厂螺丝工?还不如从8岁童工开始干活,别人读书完了你工龄18+,混不上领导也是个小头头了。当然专科进来正式工,od都行,一般本科进来13级也OK,毕竟22岁年纪摆在那个地方还不需要太花钱。读硕博的基本26岁,工作两年就要结婚的,兜里没几个崽,连彩礼都要信用贷。菊厂离职的不少,毕竟正常没人受得了9116(梗:再来一次911刷6)。为啥这时候劝?因为刚下班,因为国考刚完,省考下周,就是可惜选调只有当年应届能报。现在回想能拍断大腿。应届生真实好身份,错过这一次,选调,考公,考编,当老师,进医院,研究所,高校,央国企,基本都无缘了,就连报名资格都被剥夺了,可谓是被党和国家遗弃的废材,统称“社会上的”,扔到社会去流浪,被用坏了就扔医院,长期超负载使用,零件修不好基本可以扔火里回炉重造了。体制内奉行找体制内的,都是党和国家选的人才,智力不差,样貌不丑,身材端正,收入稳定,安居房政策福利待遇也OK。因公出行都是报销,周末顺带“游山玩水“,这种体制内单身资源但凡想找对象,去社会上随便吆喝一声都排队。观察一下,基本没什么公务员在相亲,因为早就被邻里邻居抢光了。
哈哈哈,你是老六:就这不去的人大把人干呢,现在不缺人干活,你不干大把干呢,还有那个说农民工赚钱的,那个800+我估计肯定也就那一段时间,哪有这么赚钱,还是一句话,要想存下钱必须花销极低,能省的就不花钱,工资要高点
点赞 评论 收藏
分享
评论
5
48
分享

创作者周榜

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