Serenity

热爱可抵岁月漫长

一个热爱技术、喜欢折腾的开发者。 专注于前端开发,偶尔写写后端。 记录生活,分享技术,探索未知。

点击任意处进入哦~
加载中
输入关键词开始搜索
leetcode124. 二叉树中的最大路径和

leetcode124. 二叉树中的最大路径和

暂无摘要...

leetcode
3月 Serenity
leetcode123. 买卖股票的最佳时机 III

leetcode123. 买卖股票的最佳时机 III

暂无摘要...

leetcode
3月 Serenity
leetcode297. 二叉树的序列化与反序列化

leetcode297. 二叉树的序列化与反序列化

暂无摘要...

leetcode
3月 Serenity
leetcode42. 接雨水

leetcode42. 接雨水

暂无摘要...

acwing
3月 Serenity
leetcode84. 柱状图中最大的矩形

leetcode84. 柱状图中最大的矩形

分析对于一个高度,如果能得到向左和向右的边界那么就能对每个高度求一次面积遍历所有高度,即可得出最大面积使用单调栈,在出栈操作时得到前后边界并计算面积class Solution {public: int largestRectangleArea(vector<int>& h

acwing
2月 Serenity
leetcode72. 编辑距离

leetcode72. 编辑距离

分析与acwing同源,只是要注意下标问题,f[i][j]和word[i],word[j]要对齐class Solution {public: int minDistance(string word1, string word2) { int la=word1.length(),

leetcode
2月 Serenity
leetcode60. 排列序列

leetcode60. 排列序列

分析设置当前是第几个,如果到达第k个则结束循环。class Solution {public: int path[10]; bool st[10]; string s=""; int cur=0; void dfs(int n,int u,in

leetcode
2月 Serenity
leetcode51. N 皇后

leetcode51. N 皇后

class Solution { char g[10][10]; bool col[20],dg[20],udg[20]; vector<vector<string>> res;//保存答案 vector<string> str;//用于保

leetcode
2月 Serenity
leetcode41. 缺失的第一个正数

leetcode41. 缺失的第一个正数

思路nums中有n个数,若nums中依次为1-n,则缺失的数为n+1,若其中有重复或者负数,那么这个缺失的数必在1-n中。则可以用nums这个数组作为哈希地址,由于存在重复数字,我们可以每次取nums[i]的绝对值,然后将其对应的nums的角标位置变成负数,最后遍历nums,找到第一个正数,其下标则

leetcode
1月 Serenity