![](https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
面试笔试题
面试题总结
Yummy_Ou
这个作者很懒,什么都没留下…
展开
-
【复习】算法求和题总结C++
1. 两数之和leetcode1输入:nums = [2, 6, 11, 15], target = 8输出:[0, 1]因为 nums[0] + nums[1] = 2 + 6 = 8可用暴力解法,双循环解决,时间复杂度为 O(n2)O(n^2)O(n2),空间复杂度:O(1)O(1)O(1)使用hash表,实现快速搜索,以空间换取速度,时间复杂度为 O(n)O(n)O(n),空间复杂度:O(n)O(n)O(n)使用双循环,c++中使用容器map实现(map有各种类型的Key -原创 2020-07-16 06:19:07 · 278 阅读 · 0 评论 -
【复习】编程题输入输出总结 C++
推荐使用:#include <bits/stdc++.h> 几乎万能的头文件,一个顶百个~多组2个数字输入,输出和输入2 14 1输出35#include <iostream>using namespace std; int main(){ int a=0,b=0; int sum=0; while(cin>>a>>b){ sum=a+b; cout<<原创 2020-07-12 18:07:27 · 529 阅读 · 0 评论 -
【复习】单链表代码实现C++ 含链表翻转、链表合并等算法
单链表的代码实现结点class ListNode{ public: int val; ListNode *next; ListNode(int val){ this->val=val; } }; 链表包含:增删查改操作class LinkedList{ private: ListNode *head; ListNode *tail; int size; public: LinkedList(){ head=NULL; tail=原创 2020-07-09 02:50:19 · 203 阅读 · 0 评论