笔试复盘
lardoris928
这个作者很懒,什么都没留下…
展开
-
2021-08-20
原创 2021-08-20 17:28:46 · 67 阅读 · 0 评论 -
荣耀笔试复盘第二题-
输出:原创 2021-08-20 17:28:24 · 441 阅读 · 0 评论 -
荣耀笔试复盘第一题-计算ID数量
快速幂算法long long fastPower(long long base, long long power) {//快速幂算法 避免直接乘溢出 long long result = 1; while (power > 0) { if (power & 1) {//此处等价于if(power%2==1) result = result * base % 1000; } power >>= 1;//此处等价于power=power/2 base ..原创 2021-08-20 11:51:30 · 401 阅读 · 1 评论 -
科大讯飞笔试复盘
第一题给一个十进制数 将它变为二进制后 把第二个0变为1比如 10(1010)->14(1110)2(10)->6(110)这个不知道为啥只能a90#include<iostream>#include<string>#include<algorithm>#include<vector>#include<map>#include<unordered_set>#include<stack>#i原创 2021-08-15 22:12:17 · 80 阅读 · 0 评论 -
奇安信 dfs
int ans = 0;struct node { int x, y;};int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};void dfs(vector<vector<int>> &grid, int x, int y, int &temp) { ans = max(ans, temp); int n = grid.size(), m = grid[0].size(); for (in...原创 2021-08-08 22:55:32 · 67 阅读 · 0 评论 -
华为笔试复盘 bfs-2 外卖员
#include <iostream>#include <queue>using namespace std;struct node { int now, step; };int n, m;int check[100005];int stepSize(int start, int target) { queue<node> que; que.push((node){start, 0}); while (!que.em..原创 2021-08-08 22:20:51 · 341 阅读 · 0 评论 -
华为笔试复盘 bfs-1 最大山体面积
#include <iostream>#include <queue>using namespace std;struct node { int x, y;};int n, m, ans = 0;int mmap[105][105];//存储迷宫的数组int dir[4][2] = {1, 0, 0, 1, 0, -1, -1, 0};//下,右,左,上void bfs(int x, int y) { queue<node> que...原创 2021-08-08 22:18:19 · 321 阅读 · 0 评论 -
奇安信笔试复盘 选择题
怎么这么难这家 以前都没听过文章目录单项选择无向图页式虚拟存储系统InnoDB引擎的特性不包括定义表的语句错误的是数据库临界区的论述正确的是下列关于linux的kenal space和user space描述错误的是函数内的局部静态变量存放的位置为数据结构中,在逻辑上可以把数据结构分成下列哪个不是HTTP的协议字段linux进程调度的时候,以下哪个进程状态转化是不会发生的DHCP协议的作用,正确的是关于ARP表,以下描述正确的是一棵树边的集合为下列数据结构不是线性结构的为二叉树的前序后序 推根节点的孩子节原创 2021-08-07 17:34:13 · 416 阅读 · 0 评论 -
平衡点问题(shoppee笔试题)
#include<iostream>#include<vector>#include<string>using namespace std;int find(vector<int>& inputarray){ int sum = 0; int length = inputarray.size(); for (int i : inputarray){ sum += i; } int r = sum - inputarray[0];.原创 2021-08-02 20:05:08 · 154 阅读 · 0 评论 -
leetcode 15. 三数之和 (多益网络笔试) (二维矩阵行数列数)
#include <iostream>#include <algorithm>#include <string>#include <vector>#include <unordered_map>using namespace std;class Solution {public: vector<vector<int>> threeSum(vector<int>& nums) { ...原创 2021-07-26 23:15:59 · 121 阅读 · 0 评论 -
多益网络笔试复盘
文章目录选择题1.链表具有的特点(A)2.关于队列叙述正确的是(D)3.栈,队列,链表,二叉树(B)4.一个从大到小的数组,按从小到大排序,哪种最快(C)5. 下列排序算法中,时间复杂度和记录的初始排列无关的是(B)6.下面哪种排序法对1234576最快(B)基本有序7. 下列排序算法中哪种算法是不稳定的算法(D)8.解析XML时,需要校验节点是否闭合,如必须有与之对应,用(B)数据结构实现比较好(设计模式题)9.下面SQL语句的作用时()可能是c10.以下不是使用UDP的应用层协议是(B)11.多进程在主原创 2021-07-26 22:20:18 · 927 阅读 · 0 评论 -
2021-07-22 华为笔试复盘 2.仪器云使用的调度 sort函数&&lambda表达式&&运算符重载
第一个方法:优先级队列(虽然改的稍微易懂了一点 但还是不懂 唉)#include <iostream>#include <queue>#include <xfunctional>using namespace std;struct node { int t, p;//p是优先级(越小越好) t是使用时间(越大越好) bool operator< (const node &a) const { if (this->p == ...原创 2021-07-22 15:38:36 · 426 阅读 · 0 评论 -
2021/7/22 华为笔试复盘 1.自动驾驶出租车订单分配
这个写出来的人脑子太强了代码:#include <iostream>#include <algorithm>using namespace std;int n, k;//站点数,乘客总数const int maxn = 1e4 + 10, mod = 1e9 + 7, inf = 0x3f3f3f3f;//这个maxn可能是最大乘客数加了个常数long long ans[maxn];int main(){ cin >> n >> k;...原创 2021-07-22 10:44:20 · 785 阅读 · 0 评论 -
leetcode 21. 合并两个有序链表(剑指25)(诺瓦星云复盘)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { if(l1.原创 2021-07-21 12:22:44 · 96 阅读 · 0 评论 -
(诺瓦星云复盘)已知2n+1个正整数1到2n+1,要求将这些数据排列在n条具有一个共有端点的线段上(每条线段上放置3个数),使得每条边的3个数的累加和相等
我的分析:首先 (2n+1)肯定是奇数,所以共用点是(n+1)这个数但是 共用点也可以是1 或者 (2n+1)看题的示例答案应该是共点为1#include <iostream>#include <unordered_set>#include <queue>#include <string>using namespace std;int main() { int n; cin >> n; queue<string&g.原创 2021-07-21 11:52:47 · 417 阅读 · 2 评论 -
leetcode 557. 反转字符串中的单词 III (诺瓦星云) 这个题很不错
char空格是用单引号的答案:class Solution {public: string reverseWords(string s) { int length = s.length(); int i = 0; while (i < length) { int start = i; while (i < length && s[i] != ' ') {//这里在找空.原创 2021-07-21 11:00:46 · 107 阅读 · 0 评论 -
2021-07-20 诺瓦星云笔试复盘
文章目录1.使用https时,如何对性能进行优化TCP Fast OpenHSTS(HTTP Strict Transport Security)Session Resume2.TCP协议自上向下分为哪几层,每一层列举至少一个通信协议3.ssh加密是什么4.epoll和select的区别5.什么是缓冲区溢出,有什么危害6.简单描述段页式存储管理机制7.互斥锁(mutex)机制,以及互斥锁与读写锁的区别***互斥锁******读写锁***互斥锁和读写锁的区别:Linux的4种锁机制:8.CAS无锁队列实现的原原创 2021-07-20 22:59:24 · 2059 阅读 · 2 评论