- 博客(39)
- 收藏
- 关注
原创 LeetCode 235~241题
第二百三十五题:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: TreeNode* lowestCommo
2021-01-31 11:03:35 130
原创 LeeCode 228~234题:
第二百二十八题:class Solution {public: vector<string> summaryRanges(vector<int>& nums) { vector<string> res; for (int i = 0; i < nums.size(); i ++ ) { int j = i + 1; while (j < nums.size()
2021-01-30 08:29:49 129
原创 LeetCode 221~227题
第二百二十一题:class Solution {public: int maximalSquare(vector<vector<char>>& matrix) { if (matrix.empty() || matrix[0].empty()) return 0; int n = matrix.size(), m = matrix[0].size(); vector<vector<int>>
2021-01-29 07:48:19 143
原创 LeetCode 214~220题:
第二百一十四题:class Solution {public: string shortestPalindrome(string s) { string t(s.rbegin(), s.rend()); int n = s.size(); s = ' ' + s + '#' + t; vector<int> ne(n * 2 + 2); for (int i = 2, j = 0; i <= n *
2021-01-28 13:20:06 152 1
转载 深度之眼PyTorch训练营(第二期)(仅供学习)
https://blog.csdn.net/oldmao_2001/article/details/102811784
2021-01-27 12:19:43 1466
原创 PyTorch (二)
实现逻辑回归模型import torchimport torch.nn as nnimport matplotlib.pyplot as pltimport numpy as nptorch.manual_seed(10)# ===================1、生成数据====================sample_nums = 100mean_value = 1.7bias = 1n_data = torch.ones(sample_nums, 2)x0 = torch
2021-01-27 12:07:46 66
原创 PyTorch (一)
1. PyTorch简介PyTorch是在Torch基础上用python语言重新打造的一款深度学习框架。Torch是采用Lua语言为接口的机器学习框架,但因Lua语言较为小众,导致Torch知名度不高。2. 适合人群深度学习初学者:模型算法实现容易,加深深度学习概念认识机器学习爱好者:数十行代码便可实现人脸识别,目标检测,图像生成等有趣实验算法研究员:最新arxiv论文算法快速复现3. 张量是什么?(What is Tensor)张量是一个多维数组,它是标量、
2021-01-26 20:51:45 264
原创 LeetCode 207~213题:
第二百零七题:class Solution {public: bool canFinish(int n, vector<vector<int>>& edges) { vector<vector<int>> g(n); vector<int> d(n); for (auto& e: edges) { int b = e[0], a = e[1];
2021-01-26 10:51:28 161
原创 LeetCode 200~206题
第二百题:class Solution {public: vector<vector<char>> g; int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1}; int numIslands(vector<vector<char>>& grid) { g = grid; int cnt = 0; for (int i = 0; i
2021-01-24 11:41:11 77
原创 LeetCode 187~199题
第一百八十七题:class Solution {public: vector<string> findRepeatedDnaSequences(string s) { unordered_map<string, int> cnt; for (int i = 0; i + 10 <= s.size(); i ++ ) cnt[s.substr(i, 10)] ++ ; vector<stri
2021-01-23 21:18:29 149
原创 Linux程序编程(一)
第一章 shell 脚本1. shell 概述:shell 的两层含义:既是一种应用程序,又是一种程序设计语言。shell 是用户和 Linux 内核之间的接口程序Linux 系统中提供了好几种不同的 shell 命令解释器,如 sh、ash、bash 等。一般默认使用 bash 作为默认的解释器。我们后面编写的 shell 脚本,都是由上述 shell 命令解释器解释执行的2. shell 脚本大体可以分为两类:(1)系统进行调用:这类脚本无需用户调用,系统会在合适
2021-01-22 17:02:29 490
原创 LeetCode168~179t题:
第一百六十八题:class Solution {public: string convertToTitle(int n) { int k = 1; for (long long p = 26; n > p; p *= 26) { n -= p; k ++ ; } n -- ; string res; while (k -- ) {
2021-01-22 08:59:08 177
原创 PWN(一)
1. 安装pwntools工具:pwntools是什么?pwntools 是一款专门用于CTF Exploit的python库,能够很方便的进行本地与远程利用的切换,基本涵盖了pwn题利用脚本所需要的各种工具。安装过程:sudo apt install python3-pipsudo python3 -m pip install --upgrade --force pip sudo pip install setuptools==33.1.1sudo pip3 install
2021-01-21 18:22:56 3728
原创 LeetCode 155~167题
第一百五十五题:class MinStack {public: /** initialize your data structure here. */ stack<int> stk, f; MinStack() { } void push(int x) { stk.push(x); if (f.empty() || f.top() >= x) f.push(x); } void pop() {
2021-01-21 11:58:23 72
原创 web安全基础之HTTP
1. 网站访问原理:(点击访问网站的一瞬间所发生的网络过程)网站访问原理图:2. URL介绍网址结构(URL):协议://主机头.域名:端口/文件夹/文件?参数名1=参数值1&参数名2=参数值2例如:https://baike.baidu.com/item/url/110640?fr=aladdin3. URL编码介绍:编码方式:url编码就是一个字符ascii码的十六进制,并在十六进制前加上百分号%比如“\”,它的ascii码是92,92的十六进
2021-01-20 17:01:16 779
原创 LeetCode 148~154题
第一百四十八题:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* sortList(ListNode* head) { int n = 0;
2021-01-20 09:23:39 65 1
原创 LeetCode 141~147题
第一百四十一题:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: bool hasCycle(ListNode *head) { if (!head || !head-
2021-01-19 08:01:53 62
原创 LeetCode134~140
第一百三十四题:class Solution {public: int canCompleteCircuit(vector<int>& gas, vector<int>& cost) { int n = gas.size(); for (int i = 0, j; i < n; ) { // 枚举起点 int left = 0; for (j = 0; j < n
2021-01-14 19:14:01 65
原创 LeetCode 127~133题
第一百二十七题:class Solution {public: int ladderLength(string beginWord, string endWord, vector<string>& wordList) { unordered_set<string> S; for (auto& word: wordList) S.insert(word); unordered_map<string, in
2021-01-13 21:15:00 90
原创 LeetCode 120~126题
第一百二十题:class Solution {public: int minimumTotal(vector<vector<int>>& f) { for (int i = f.size() - 2; i >= 0; i -- ) for (int j = 0; j <= i; j ++ ) f[i][j] += min(f[i + 1][j], f[i + 1][j + 1]);
2021-01-11 10:43:39 98
原创 vim 技巧2:(正常模式下)
1. o命令可以另起一行2. 反向删除:db命令可以删除从光标起始位置到单词开头的内容3. 正向删除:b命令可以将光标移到单词的开头,用dw命令删除整个单词。4. daw删除一个单词“delete a word”5. d2w和2dw删除两个单词6. gUaw把当前单词转换为大写形式7.dap删除整个段落8. \ap将当前段落切换为注释状态,\G从当前行到文件结尾间的所有内容注释掉,\\注释当前行9.命令用途c修改d删除y复制到寄存器g~反转大小
2021-01-11 10:17:55 94
原创 LeetCode 113~119
第一百一十三题:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: vector<vector<in
2021-01-10 22:33:37 59
原创 vim 技巧1:(正常模式下)
1. .命令会重复上次修改(切换到其他模式之前所有命令之和)2. x命令会删除光标下的字符3. u命令可以撤销修改4. dd命令会把一整行一起删掉5.>G命令会增加从当前行到文档末尾处的缩进等级6. $命令会把光标移到行尾7. a命令在当前光标之后添加内容8. A命令则在当前行的结尾添加内容9. A可以用$a代替10. s命令先删除光标下的字符,然后进入插入模式。11. f{char}查找下一个指定字符出现的位置,如果找到了,光标就会移到那里。f+,光标就会直接移到下一个。12
2021-01-09 21:34:24 133
原创 LeetCode 106~112题
第一百零六题:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: unordered_map<int, i
2021-01-09 14:56:12 70
原创 LeetCode 99~105题
第九十九题:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr)
2021-01-08 11:02:21 112
原创 LeetCode 92~98题
第九十二题:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* reverseBetween(ListNode* head, int m, int n) {
2021-01-05 19:33:17 71
原创 LeetCode 85~91题
第八十五题:class Solution {public: int largestRectangleArea(vector<int>& h) { int n = h.size(); vector<int> left(n), right(n); stack<int> stk; for (int i = 0; i < n; i ++ ) { while (stk
2021-01-02 22:54:53 78
原创 LeetCode 78~84题
第七十八题:class Solution {public: vector<vector<int>> subsets(vector<int>& nums) { vector<vector<int>> res; int n = nums.size(); for (int i = 0; i < 1 << n; i ++ ) { vector<
2021-01-02 14:03:34 170 1
原创 LeetCode 71~77题
第七十一题:class Solution {public: string simplifyPath(string path) { string res, name; if (path.back() != '/') path += '/'; for (auto c : path) { if (c != '/') name += c; else { if (name ==
2021-01-01 22:39:24 104
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人