摘要:
题目链接:https://www.acwing.com/problem/content/1946/ 个人题解: 开一个哈希表存三个字符串的和 要记得给输入的三个字符串排序 hash存在二义性,因此用了hash_ 代码: #include <iostream> #include <cstring> # 阅读全文
posted @ 2022-04-18 23:21
黑VS白-清墨
阅读(18)
评论(0)
推荐(0)
摘要:
第一题 题目链接:https://leetcode-cn.com/problems/remove-element/ 个人题解:因为要原地修改数组,所以要双指针。从前往后遍历一遍即可 代码: class Solution { public: int removeElement(vector<int>& 阅读全文
posted @ 2022-04-18 16:05
黑VS白-清墨
阅读(69)
评论(0)
推荐(0)
摘要:
三道题 第一题 题目链接:https://leetcode-cn.com/problems/maximum-subarray/ 个人题解:经典动态规划 代码: class Solution { public: int maxSubArray(vector<int>& nums) { int res= 阅读全文
posted @ 2022-04-18 14:36
黑VS白-清墨
阅读(43)
评论(0)
推荐(0)
摘要:
题目链接:https://www.acwing.com/problem/content/1844/ 个人题解:暴力枚举即可 代码: #include <iostream> #include <cstring> #include <algorithm> using namespace std; int 阅读全文
posted @ 2022-04-18 14:12
黑VS白-清墨
阅读(21)
评论(0)
推荐(0)
摘要:
题目链接:https://leetcode-cn.com/problems/lexicographical-numbers/ 个人题解: 我们用一个 $tire$ 树来表示所有的数,如果当前数是在 $1-n$ 范围内的,就插入到答案中。因为表示了所有数,所以没必要模拟一个 $tire$ 数并且插入。 阅读全文
posted @ 2022-04-18 07:17
黑VS白-清墨
阅读(22)
评论(0)
推荐(0)

浙公网安备 33010602011771号