摘要:
class Solution { public: // dfs vector<vector<int>> res; vector<int> path; // 只能是全局变量 bool flag[100]; int n=0; void dfs(int u,vector<int>& nums){ if(u 阅读全文
摘要:
206. 反转链表 来自 <https://leetcode.cn/problems/reverse-linked-list/> /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *n 阅读全文
摘要:
21. 合并两个有序链表 来自 <https://leetcode.cn/problems/merge-two-sorted-lists/> /** * Definition for singly-linked list. * struct ListNode { * int val; * ListN 阅读全文
摘要:
785. 快速排序 来自 <https://www.acwing.com/problem/content/submission/code_detail/18083617/> #include<iostream> using namespace std; const int N=100010; int 阅读全文
摘要:
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
摘要:
class Solution { public: // 除k取余法求二进制 (暴力) vector<int> countBits(int n) { vector<int> ans; for(int i=0;i<=n;i++){ int t=i; int count=0; while(t!=0){ i 阅读全文
摘要:
/* // Definition for a Node. class Node { public: int val; Node* left; Node* right; Node* next; Node() : val(0), left(NULL), right(NULL), next(NULL) { 阅读全文
摘要:
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
摘要:
567. 字符串的排列 来自 <https://leetcode.cn/problems/permutation-in-string/?envType=study-plan&id=suan-fa-ru-men&plan=algorithms&plan_progress=sc0sqw2> class 阅读全文
摘要:
733. 图像渲染 来自 <https://leetcode.cn/problems/flood-fill/> class Solution { public: // bfs int dx[4]={-1,0,1,0}; int dy[4]={0,1,0,-1}; vector<vector<int> 阅读全文