大疆笔试(2023-08-13)ak 好简单,应该主要卡面试

1. 输出无重复3位数

时间限制: 3000MS 内存限制: 65536KB 题目描述: 从{1,2,3,4,5,6,7,8,9}中随机挑选不重复的5个数字作为输入数组'selectedDigits',能组成多少个互不相同且无重复数字的3位数?请编写程序,从小到大顺序,以数组形式,输这些3位数。

输入描述 selectedDigits = {1,2,3,4,5}

输出描述 123 124 125 132 134 135 142 143 145 152 153 154 213 214 215 231 234 235 241 243 245 251 253 254 312 314 315 321 324 325 341 342 345 351 352 354 412 413 415 421 423 425 431 432 435 451 452 453 512 513 514 521 523 524 531 532 534 541 542 543

样例输入 5 1 2 3 4 5 样例输出 123 124 125 132 134 135 142 143 145 152 153 154 213 214 215 231 234 235 241 243 245 251 253 254 312 314 315 321 324 325 341 342 345 351 352 354 412 413 415 421 423 425 431 432 435 451 452 453 512 513 514 521 523 524 531 532 534 541 542 543

提示 整型数组

数据格式:以空格分隔的整型数字。

样例:

1 2 3

#include <iostream>
#include <vector>
#include <numeric>
#include <limits>

using namespace std;

class Solution {
    vector<int> res;
    void dfs(vector<int>& selectedDigits, vector<int> cur, vector<bool>& isUsed) {
        if (cur.size() == 3) {
            res.push_back(cur[0] * 100 + cur[1] * 10 + cur[2]);
            return;
        }
        for (int i = 0; i < selectedDigits.size(); i++) {
            if (isUsed[i] == false) {
                isUsed[i] = true;
                cur.push_back(selectedDigits[i]);
                dfs(selectedDigits, cur, isUsed);
                cur.pop_back();
                isUsed[i] = false;
            }
        }
    }
public:

    /* Write Code Here */
    vector < int > ThreeDigitNumbers(vector < int > selectedDigits) {
        vector<bool> isUsed(5);
        vector<int> cur;
        dfs(selectedDigits, cur, isUsed);
        return res;
    }
};
int main() {
    vector < int > res;

    int selectedDigits_size = 0;
    cin >> selectedDigits_size;

    vector<int> selectedDigits;
    int selectedDigits_item;
    for (int selectedDigits_i = 0; selectedDigits_i < selectedDigits_size; selectedDigits_i++) {
        cin >> selectedDigits_item;

        selectedDigits.push_back(selectedDigits_item);
    }

    Solution* s = new Solution();
    res = s->ThreeDigitNumbers(selectedDigits);
    for (int res_i = 0; res_i < res.size(); res_i++) {
        cout << res[res_i] << endl;;
    }
    return 0;
}

alt

2. 计算无人机飞行坐标

时间限制: 3000MS 内存限制: 65536KB 题目描述: 编写一个程序,模拟无人机的飞行路径。给定一个包含指令的字符串 (例如:"RUDDLLUR"),每个指令代表无人机在二维平面上移动的方向(U:前、D:后、L:左、R:右),请计算无人机的最终坐标并输出。

输入描述 RUDDLLURRR

输出描述 无人机的最终坐标是: (2, 0)

样例输入 ​RUDDLLUR 样例输出 0 0

提示 无人机开始的坐标是(0,0),每执行1个指令,对应坐标方向+1。

#include <iostream>
#include <vector>
#include <numeric>
#include <limits>
#include <string>

using namespace std;

class Solution {
public:

    /* Write Code Here */
    vector < int > calculateFinalPositi(string instructions) {
        int x = 0, y = 0;
        for (int i = 0; i < instructions.size(); i++) {
            if (instructions[i] == 'U') {
                y++;
            }
            else if (instructions[i] == 'D') {
                y--;
            }
            else if (instructions[i] == 'L') {
                x--;
            }
            else if (instructions[i] == 'R') {
                x++;
            }
        }
        vector<int> res(2);
        res[0] = x;
        res[1] = y;
        return res;
    }
};
int main() {
    vector < int > res;

    string instructions;
    getline(cin, instructions);
    Solution* s = new Solution();
    res = s->calculateFinalPositi(instructions);
    for (int res_i = 0; res_i < res.size(); res_i++) {
        cout << res[res_i] << endl;;
    }

    return 0;
}

alt

全部评论
?为什么我的是文件系统查找关键字😇
5 回复 分享
发布于 2023-08-14 08:15 浙江
第一题模板,第二题属于大学课后作业,这么简单要是放在十年前倒也没啥,现在这么搞,很有一种KPI面或者大扩招的感觉。。。
2 回复 分享
发布于 2023-08-14 19:26 山东
保存代码就是提交了吧?
1 回复 分享
发布于 2023-08-13 23:02 河南
很敷衍啊这两道
1 回复 分享
发布于 2023-08-13 21:16 天津
我前端也这套
点赞 回复 分享
发布于 2023-08-16 14:48 北京
不是,为啥这套题这么简单,是大疆的岗位吗?我的为啥难死啊,哥们啥岗位啊
点赞 回复 分享
发布于 2023-08-15 14:29 河北
前端开发也是这套题
点赞 回复 分享
发布于 2023-08-14 18:06 四川
同这套
点赞 回复 分享
发布于 2023-08-14 16:48 江苏
这两道太简单以至于让我产生了一种不招人了的感觉😭
点赞 回复 分享
发布于 2023-08-14 14:34 四川

相关推荐

Tom哥981:让我来压力你!!!: 这份简历看着“技术词堆得满”,实则是“虚胖没干货”,槽点一抓一大把: 1. **项目描述是“技术名词报菜名”,没半分自己的实际价值** 不管是IntelliDoc还是人人探店,全是堆Redis、Elasticsearch、RAG这些时髦词,但你到底干了啥?“基于Redis Bitmap管理分片”是你写了核心逻辑还是只调用了API?“QPS提升至1500”是你独立压测优化的,还是团队成果你蹭着写?全程没“我负责XX模块”“解决了XX具体问题”,纯把技术文档里的术语扒下来凑字数,看着像“知道名词但没实际动手”的实习生抄的。 2. **短项目塞满超纲技术点,可信度直接***** IntelliDoc就干了5个月,又是RAG又是大模型流式响应又是RBAC权限,这堆活儿正经团队分工干都得小半年,你一个后端开发5个月能吃透这么多?明显是把能想到的技术全往里面塞,生怕别人知道你实际只做了个文件上传——这种“技术堆砌式造假”,面试官一眼就能看出水分。 3. **技能栏是“模糊词混子集合”,没半点硬核度** “熟悉HashMap底层”“了解JVM内存模型”——“熟悉”是能手写扩容逻辑?“了解”是能排查GC问题?全是模棱两可的词,既没对应项目里的实践,也没体现深度,等于白写;项目里用了Elasticsearch的KNN检索,技能栏里提都没提具体掌握程度,明显是“用过但不懂”的硬凑。 4. **教育背景和自我评价全是“无效信息垃圾”** GPA前10%这么好的牌,只列“Java程序设计”这种基础课,分布式、微服务这些后端核心课提都不提,白瞎了专业优势;自我评价那堆“积极认真、细心负责”,是从招聘网站抄的模板吧?没有任何和项目挂钩的具体事例,比如“解决过XX bug”“优化过XX性能”,纯废话,看完等于没看。 总结:这简历是“技术名词缝合怪+自我感动式凑数”,看着像“背了后端技术栈名词的应届生”,实则没干货、没重点、没可信度——面试官扫30秒就会丢一边,因为连“你能干嘛”都没说清楚。
点赞 评论 收藏
分享
评论
13
28
分享

创作者周榜

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