(已约面)6.11滴滴,北京网约车后端开发23届秋储实习笔试

#选择题不太会的

  • 树的度为5,其中度为1,2,3,4,5得节点个数为5,4,3,2,1 求子节点数
  • 文件传输服务器得数据连接端口
  • Runnable 相比Thread的优点
  • Linux更改目录文件的属组

编程题

序列拆分

输入多个 一个1-n的正整数序列,如果能拆分成一个递增序列和一个递减序列就输出Yes 否则输出No 例如 输入 8 6 1 3 2 4 5 输出 Yes

字符串替换

输入一个字符串 然后进行n次替换 每次将字符串里的 str1 替换成 str2 最后输出被替换n次的字符串

例如 输入 abcabc 2 bca abb bbb aac 输出 aaaacc

其他

赛码平台,还不需要***控,要摄像头 题目比较简单

我第一道编程题只过了18%脑袋大

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = 0;
        n = sc.nextInt();
        

        while (n-- > 0) {

            int len = 0;
            len = sc.nextInt();
            if (len == 1) {
                System.out.println("Yes");
                continue;
            }
            List<Integer> list = new ArrayList<Integer>();
            int temp = 0;

            int maxNum = Integer.MIN_VALUE;
            int maxIndex = 0;
            int minNum = Integer.MAX_VALUE;
            int minIndex = 0;

            for (int i = 0; i < len; ++i) {
                temp = sc.nextInt();
                list.add(temp);
                if (temp > maxNum) {
                    maxNum = temp;
                    maxIndex = i;
                }
                if (temp < minNum) {
                    minNum = temp;
                    minIndex = i;
                }
            }
            
            list.set(minIndex, -1);
            list.set(maxIndex, -1);
            
            for (int i = minIndex + 1; i < len; ++i) {
                if (list.get(i) != -1) {
                    if (list.get(i) > minNum) {
                        minNum = list.get(i);
                        list.set(i, -1);
                    }
                }
            }
            
            for (int i = maxIndex + 1; i < len; ++i) {
                if (list.get(i) != -1) {
                    if (list.get(i) < maxNum) {
                        maxNum = list.get(i);
                        list.set(i, -1);
                    }
                }
            }

            String res = "Yes";
            for (int i = 0; i < len; ++i) {
                if (list.get(i) != -1) {
                    res = "No";
                    break;
                }
            }
            System.out.println(res);
        }

        sc.close();
    }
}
大家可以投一投
# 最新进展
6.15 20:02收到面试邀请,以为挂了,不过楼主最近在准备期末,也感觉挺悬的。。。
#滴滴##笔试##滴滴实习#
全部评论
第二题答案有人发一下吗
3 回复 分享
发布于 2022-06-11 21:45
第一题,回溯找到所有的递增序列,然后每次递归都判断剩下未标记的数字是否严格递减     static int[] book;     static int[] nums;     static int n;     static List<Integer> path = new ArrayList<>();     public static void main(String[] args)  {         nums = new int[]{8,6,1,3,2,4,5};         n = nums.length;         book = new int[n];         dfs(0,Integer.MIN_VALUE);     }     public static void dfs(int beg,int pre){         if(check())//每次check一下剩下的数组是否完全递减             System.out.println(path);         for(int i = beg; i < n; i++){//每次从上一个数的下标+1开始             if(book[i] == 0){                 if(nums[i] > pre){//如果本次是递增的才继续递归                     book[i] = 1;                     path.add(nums[i]);                     dfs(i+1,nums[i]);                     path.remove(path.size()-1);                     book[i] = 0;                 }             }         }     } //所有符合的解 [1, 3, 4, 5] [1, 2, 4, 5] [1, 4, 5]
2 回复 分享
发布于 2022-06-11 22:34
{"pureText":"","imgs":[{"alt":"discuss_165****115090.jpeg","height":889,"localSrc":"content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FTencent%2FQQ_Images%2F1a79e723b7994205.png","src":"https://uploadfiles.nowcoder.com/message_images/20220613/525666935_1655051114658/discuss_1655051115090.jpeg","width":453},{"alt":"discuss_165****122520.jpeg","height":581,"localSrc":"content://com.miui.gallery.open/raw/%2Fstorage%2Femulated%2F0%2FTencent%2FQQ_Images%2F43b5692829b6e2a8.png","src":"https://uploadfiles.nowcoder.com/message_images/20220613/525666935_1655051122052/discuss_1655051122520.jpeg","width":668}]}
1 回复 分享
发布于 2022-06-13 00:25
楼主有笔试结果了吗?😁
1 回复 分享
发布于 2022-06-12 22:52
就没有用python的吗,第一题直接放弃了😭
1 回复 分享
发布于 2022-06-11 22:52
哈希表不行,这题我是回溯的,能过100%
1 回复 分享
发布于 2022-06-11 21:30
杭州还是北京呀?
点赞 回复 分享
发布于 2022-06-16 09:40
是秋储嘛兄弟?
点赞 回复 分享
发布于 2022-06-14 19:39
第一题我用深度。。。几行就a了
点赞 回复 分享
发布于 2022-06-11 23:27
我第一题也没过,楼主有答案吗,我想看看😭
点赞 回复 分享
发布于 2022-06-11 21:17

相关推荐

头像
04-27 15:11
已编辑
华东师范大学 算法工程师
暑期实习从2月开始投,面了两个月,流程该挂的都挂完了,腾讯字节一共号称是1.7w个hc,不知道都发给谁了,估计今年秋招要难顶。Timeline米哈游、美团、蚂蚁、微软等公司直接简历挂穿,没进面。携程:3.3&nbsp;投递、测评3.12&nbsp;笔试3.18&nbsp;一面3.25&nbsp;二面4.13&nbsp;ai面(hr面)4.14&nbsp;英语测评4.23&nbsp;offer(已拒)腾讯:2.6&nbsp;测评2.28&nbsp;wxg一面3.5&nbsp;wxg二面(挂)3.11&nbsp;teg一面3.21&nbsp;teg二面(取消)3.31&nbsp;teg一面4.10&nbsp;teg二面(挂)4.21&nbsp;wxg一面4.24&nbsp;wxg二面(挂)字节:1.28&nbsp;aml约面(取消)3.17&nbsp;火山一面(挂)4.8&nbsp;aml一面(挂)4.20&nbsp;抖音data一面(挂)阿里:3.23&nbsp;投递、测评3.28&nbsp;笔试3.31&nbsp;淘天一面4.8&nbsp;钉钉一面4.9&nbsp;淘天二面4.10&nbsp;阿里控股一面4.12&nbsp;钉钉二面(取消)4.15&nbsp;淘天hr面4.16&nbsp;淘天offer(已接)4.21&nbsp;高德一面(取消)4.22&nbsp;淘宝闪购一面(取消)面试最大的感触是,现在撞上ai转型,一堆老业务急着转向,新业务非常不成熟,研究型的组bar非常高根本进不去,业务侧挂着算法的岗位干的都是工程活,面试却又要问算法,另外agent的落地也远没有那么广,绝大多数还是那套写死的系统调一下llm&nbsp;api或者做做rag,其余少部分真的在搭agent的,基本不能在线上服务用什么很智能的模型,现阶段成本太高,进去大概率就是给垃圾模型从工程方面兜底,除了业务场景的应用和数据经验以外,技术方面很难有什么提升。算法岗做不了基模的还是去搜广推好,之前判断失误了完全没投,秋招不知道还进不进得去。
嵌入式的小白:不错啊,淘天也是挺好的,恭喜
我的求职进度条
点赞 评论 收藏
分享
评论
10
32
分享

创作者周榜

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