百度大模型研发日常实习

一面

c++ 完全忘光外加 paddle框架完全不懂 疯狂被拷打

自我介绍(5分钟)

c++:指针和引用的区别

new delete/malloc free 的区别是啥

c11里面智能指针了解吗

paddle 的架构了解吗

算子是什么 paddle算子 从顶层到底层执行的过程是怎样的?

算法题: 找出给定字符串中没有重复字符的最长子串的长度



二面

自我介绍(5分钟)

组里是什么方向?简单问了问项目(5分钟)

算法题:最大子数组和问题

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int maxSubArray(vector<int>& nums) {
    int currentSum = nums[0];
    int maxSum = nums[0];

    for (int i = 1; i < nums.size(); i++) {
        // 如果当前和加上 nums[i] 还不如 nums[i] 本身大,就重新开始
        currentSum = max(nums[i], currentSum + nums[i]);
        maxSum = max(maxSum, currentSum);
    }

    return maxSum;
}

int main() {
    vector<int> nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
    cout << "最大子数组和为:" << maxSubArray(nums) << endl;
    return 0;
}

全部评论

相关推荐

评论
2
收藏
分享

创作者周榜

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