拼多多4月27笔试题目

#笔试题目##拼多多#
全部评论
第三题  https://blog.csdn.net/weixin_42330095/article/details/116210489
2 回复
分享
发布于 2021-04-27 22:15
第四题 回溯 class Pdd4 {     public int MinMax = Integer.MAX_VALUE;     public void reset() {         MinMax = Integer.MAX_VALUE;     }     public void helper(int[] frogs, int M, int K, int loc) {         int T = frogs.length;         if (M == 0) {             int max = max(frogs);             MinMax = Math.min(MinMax, max);             return;         }         if (loc < 0 || loc >= T) {             return;         }         int tmp = frogs[loc];         frogs[loc] = frogs[loc] <= K ? 0 : frogs[loc] - K;         helper(frogs, M-1, K, loc+1);         helper(frogs, M-1, K, loc-1);         frogs[loc] = tmp;     }     public int max(int[] frogs, int head, int rear) {         int ret = 0;         for (int i=head; i <= rear; i++) {             ret = Math.max(frogs[i], ret);         }         return ret;     }     public int max(int[] frogs) {         int ret = 0;         for (int i: frogs) {             ret = Math.max(i, ret);         }         return ret;     } }
1 回复
分享
发布于 2021-04-27 22:02
百信银行
校招火热招聘中
官网直投
pdd笔试多少分能过呀
1 回复
分享
发布于 2021-04-27 23:20
求AC代码
点赞 回复
分享
发布于 2021-04-27 21:47
第一题用结构体预处理一个细胞1-x天的分裂数,然后反向从大到小遍历,比n小就加入答案,n同时更新一下;第二题预处理前缀0个数和后缀0个数,然后暴力枚举长度,遍历01数组就可以;第三题我是用当前x中1的个数和k相比分情况讨论,没AC,过了大概85%,第四题不会
点赞 回复
分享
发布于 2021-05-01 15:51

相关推荐

点赞 评论 收藏
转发
2 18 评论
分享
牛客网
牛客企业服务