庾信平生最萧瑟
码龄6年
关注
提问 私信
  • 博客:175,200
    175,200
    总访问量
  • 411
    原创
  • 1,665,765
    排名
  • 19
    粉丝
  • 0
    铁粉

个人简介:坎坷之路 终抵星空

IP属地以运营商信息为准,境内显示到省(区、市),境外显示到国家(地区)
IP 属地:北京市
  • 加入CSDN时间: 2019-02-18
博客简介:

庾信平生最萧瑟

博客描述:
除却君身三重雪,天下谁人配白衣
查看详细资料
个人成就
  • 获得71次点赞
  • 内容获得35次评论
  • 获得252次收藏
  • 代码片获得573次分享
创作历程
  • 338篇
    2020年
  • 73篇
    2019年
成就勋章
TA的专栏
  • LeetCode
    301篇
  • deep learning
    15篇
  • python
    20篇
  • machine learning
    10篇
  • 数据结构与算法
    34篇
  • NumPy
    12篇
  • keras
    1篇
  • NLP
    2篇
  • 微信公众号
    1篇
  • Tensorflow
    4篇
  • MySQL
    1篇
  • matplot
    4篇
  • sklearn
    3篇
  • pandas
    1篇
  • Open-CV
    12篇
兴趣领域 设置
  • 人工智能
    opencv计算机视觉机器学习深度学习神经网络tensorflowpytorch图像处理数据分析
创作活动更多

AI大模型如何赋能电商行业,引领变革?

如何使用AI技术实现购物推荐、会员分类、商品定价等方面的创新应用?如何运用AI技术提高电商平台的销售效率和用户体验呢?欢迎分享您的看法

181人参与 去创作
  • 最近
  • 文章
  • 代码仓
  • 资源
  • 问答
  • 帖子
  • 视频
  • 课程
  • 关注/订阅/互动
  • 收藏
搜TA的内容
搜索 取消

LeetCode 797. 所有可能的路径

原题目:https://leetcode-cn.com/problems/all-paths-from-source-to-target/思路:使用BFS + 回溯算法代码:class Solution { vector<vector<int>> ans; vector<int> tmp; void bfs(vector<vector<int>>& graph,int index){ ..
原创
发布博客 2020.11.05 ·
434 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 1365. 有多少小于当前数字的数字

原题目:https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number/思路:采用计数排序的方法代码:class Solution {public: vector<int> smallerNumbersThanCurrent(vector<int>& nums) { vector<int> cnt(10..
原创
发布博客 2020.10.26 ·
285 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 143. 重排链表

原题目:https://leetcode-cn.com/problems/reorder-list/思路:使用vector存储节点,然后使用双指针进行重新连接,最后注意最后的节点的next置为空代码:class Solution {public: void reorderList(ListNode *head) { if (head == nullptr) { return; } vector&l..
原创
发布博客 2020.10.20 ·
305 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

重定向 --- 同时在中断和文件进行输出

重定向 --- 同时在中断和文件进行输出使用重定向技术,在模型训练的过程中同时在中断和日志文件中输出我们的结果。代码:class Logger(object): def __init__(self, filename='default.log', stream=sys.stdout): self.terminal = stream self.log = open(filename, 'a') def write(self, message):..
原创
发布博客 2020.10.16 ·
213 阅读 ·
1 点赞 ·
0 评论 ·
0 收藏

LeetCode 977. 有序数组的平方

原题目:https://leetcode-cn.com/problems/squares-of-a-sorted-array/思路:使用双指针,从后向前加元素。代码:class Solution {public: vector<int> sortedSquares(vector<int>& A) { int i=0,j=A.size()-1,index = A.size()-1; vector<in..
原创
发布博客 2020.10.16 ·
319 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 116. 填充每个节点的下一个右侧节点指针

原题目:https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/思路:采用BFS,使用size记录该层的个数,然后修改next指针就可以了代码class Solution {public: Node* connect(Node* root) { if(root == nullptr) return root; queue<Node*&..
原创
发布博客 2020.10.16 ·
107 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 1002. 查找常用字符

原题目:https://leetcode-cn.com/problems/find-common-characters/思路:使用哈希表,每次遍历完一个字符串后,取最小的次数代码:class Solution {public: vector<string> commonChars(vector<string>& A) { vector<int> m(26,INT_MAX); vector<..
原创
发布博客 2020.10.14 ·
135 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 530. 二叉搜索树的最小绝对差

原题目:https://leetcode-cn.com/problems/minimum-absolute-difference-in-bst/思路:中序遍历,求解相邻接点的差值绝对值的最小值代码:class Solution { bool flag; int ans,pre; void dfs(TreeNode* root){ if(root == nullptr) return; dfs(root->left)..
原创
发布博客 2020.10.12 ·
164 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 75. 颜色分类

原题目:https://leetcode-cn.com/problems/sort-colors/思路:使用双指针,l记录当前左边到的位置,r记录右边到的位置为0,移动到前面。l++,cur++;为2移动到后面。r--。(此时不可以cur++,因为nums[r]使我们没有碰到过得元素)1时进行下一个元素的判断。cur++代码:class Solution {public: void sortColors(vector<int>& num..
原创
发布博客 2020.10.07 ·
98 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 834. 树中距离之和

原题目:https://leetcode-cn.com/problems/sum-of-distances-in-tree/思路:采用树形动态规划的思想。对于每一个节点来说,所有节点到他的距离之和的状态转移方程为:其中dp[v]代表以v为根的所有节点到他的距离,sz[v]表示已v为根的子树节点的数量。当一次遍历完,得到了所有节点的dp时,我们不需要以另一个节点为根重新遍历,只需要对树结构进行变化(官方解答的视频),所以每一次做变化我们只需要变换dp[u],sz[u],dp[v],s.
原创
发布博客 2020.10.06 ·
227 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 771. 宝石与石头

原题目:https://leetcode-cn.com/problems/jewels-and-stones/思路:构造哈希表代码:class Solution {public: int numJewelsInStones(string J, string S) { map<char,int> h; for(char& c:J) h[c] = 1; int sum = 0; for(c..
原创
发布博客 2020.10.02 ·
119 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

跑深度学习模型进行的日志输出

跑深度学习模型进行的日志输出构造Logger类进行输出重定向。在write函数中,使用两个函数使得命令行和日志都有输出class Logger(object): def __init__(self, filename='default.log', stream=sys.stdout): self.terminal = stream self.log = open(filename, 'a') def write(self, message): .
原创
发布博客 2020.10.02 ·
1056 阅读 ·
0 点赞 ·
0 评论 ·
1 收藏

nvidia-smi 实时刷新

watch -n0.1-dnvidia-smi #每隔0.1秒刷新一次
原创
发布博客 2020.09.30 ·
1503 阅读 ·
2 点赞 ·
0 评论 ·
0 收藏

LeetCode 79. 单词搜索

原题目:https://leetcode-cn.com/problems/word-search/思路:简单的回溯算法,开一个数组记录访问过得节点代码:class Solution { bool flag=false; void dfs(vector<vector<char>>& board,string& word,vector<vector<int>>& v,int x,int y,in..
原创
发布博客 2020.09.27 ·
86 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 60. 第k个排列

原题目:https://leetcode-cn.com/problems/permutation-sequence/思路:康拓展开代码:class Solution {public: string getPermutation(int n, int k) { vector<char> chs={'1','2','3','4','5','6','7','8','9'}; const int factor[]={1,1,2,6,24,120,720,5040..
原创
发布博客 2020.09.27 ·
118 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 235. 二叉搜索树的最近公共祖先

原题目:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/思路:利用二叉搜索树的性质代码:class Solution {public: TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) { if(root->val > p->va..
原创
发布博客 2020.09.27 ·
122 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 501. 二叉搜索树中的众数

原题目:https://leetcode-cn.com/problems/find-mode-in-binary-search-tree/思路:对BST采用中序遍历,如果当前节点的值不等于前一节点的值,那么就对其进行判断,看看前一节点值得次数是否大于了maxn。分情况进行处理。细节:记得对中序遍历的第一个节点做初始化,中序遍历的最后一种节点在递归过程中是不会进行判断的(因为其后面没有节点和他进行比较),所以在main函数中,要对这一情况做单独的判断。代码:class S..
原创
发布博客 2020.09.25 ·
90 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

差分进化算法

1 简介最优化方法分为传统优化方法和启发式方法,传统的优化算法大多数都是利用目标函数的导数求解,而启发式优化方法以放生算法为主,通过启发式搜索策略实现求解优化,启发式搜索算法不要求目标函数连续,可微等信息,具有较好的全局寻优能力。是一种用于最优化问题的后设启发式算法,本质上是一种基于实数编码的具有保优思想的贪婪遗传算法。在AI领域,演化算法是演化计算的一个重要分支,基于群体的元启发式优化算法,具有自适应、自搜索、自组织和隐并行性等特点。目前演化算法广泛应用于求解无约束函数优化、约束函数优化、组合
原创
发布博客 2020.09.24 ·
565 阅读 ·
0 点赞 ·
0 评论 ·
3 收藏

LeetCode 896. 单调数列

原题目:https://leetcode-cn.com/problems/monotonic-array/思路:使用两个flag(a和b)来表明里面存在增和减的情况,如果两者同时出现,那么就不单调代码:class Solution {public: bool isMonotonic(vector<int>& A) { if(A.size() < 3) return true; int a=0,b=0; ..
原创
发布博客 2020.09.23 ·
120 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

LeetCode 617. 合并二叉树

原题目:https://leetcode-cn.com/problems/merge-two-binary-trees/思路:构造新的节点,判断递归的终止条件就可以代码:class Solution {public: TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) { if(t1 ==nullptr) return t2; if(t2 == nullptr) return t1; ..
原创
发布博客 2020.09.23 ·
95 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏
加载更多