归档
时光荏苒,文字留痕
共 426 篇文章
acwing902. 最短编辑距离
暂无摘要...
acwing897. 最长公共子序列
暂无摘要...
leetcode53. 最大子数组和
分析用f[i]来表示数组中第i个位置的最大数组和,那么计算f[i]的时候就需要从f[i-1]转移过来,转移方程为f[i]=max(f[i-1]+nums[i],nums[i]),由于只与f[i]和f[i-1]有关,可以用pre来表示i-1,ans来表示i。class Solution {public
leetcode51. N 皇后
class Solution { char g[10][10]; bool col[20],dg[20],udg[20]; vector<vector<string>> res;//保存答案 vector<string> str;//用于保
acwing896. 最长上升子序列 II
暂无摘要...
acwing895. 最长上升子序列
暂无摘要...
leetcode50. Pow(x, n)
分析使用快速幂做法class Solution {public: double myPow(double x, int n) { double ans=1.0; if(x==0)return 0.0; long b=n; if(b<
acwing875. 快速幂
暂无摘要...
leetcode49. 字母异位词分组
分析string排序后的值相同的,可以使用字符串哈希将对应的字符串加进vector中,最后遍历哈希表,得到答案class Solution {public: vector<vector<string>> groupAnagrams(vector<string>
acwing898. 数字三角形
暂无摘要...