摘要: 题目链接: 考虑使用循环链表来维护该环形数据结构。但下列代码只能通过70/100 #include <bits/stdc++.h> using namespace std; int ne[50]; int main() { int k, n, m; bool flag = true; cin >> 阅读全文
posted @ 2024-01-14 23:44 胖柚の工作室 阅读(46) 评论(0) 推荐(0)
摘要: 题目链接: 方法一: 若数组中有数字的出现次数超过数组长度的一半(绝对众数),则将该数组排序后中间位置的数一定就是该数。 class Solution { public: int moreThanHalfNum_Solution(vector<int>& nums) { sort(nums.begi 阅读全文
posted @ 2024-01-14 20:58 胖柚の工作室 阅读(20) 评论(0) 推荐(0)
摘要: 题目链接: 由于需要统计字符串中各字符的出现次数,考虑使用\(\rm map\)来进行统计。 字符串中只有\(\rm P,A,T\)三种字母 \(\longrightarrow \rm map.size()==3\) 题目仅给出了几条规则,因此我们将可能正确的结果罗列出来,看看能否找到一些规律。 分 阅读全文
posted @ 2024-01-14 17:49 胖柚の工作室 阅读(19) 评论(0) 推荐(0)