LeetCode竞赛
LeetCode周赛、双周赛等竞赛的个人参与记录
xiaok0707
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode - 第37场双周赛
Rank 这次的 C、D 都有难度,比赛时没有好的思路. A. 删除某些元素后的数组均值 简单模拟. class Solution { public: double trimMean(vector<int>& arr) { int n=arr.size(); sort(arr.begin(),arr.end()); double ans=0; int sz=n/20; for(int i=sz;i+原创 2020-11-28 23:37:26 · 272 阅读 · 0 评论 -
LeetCode - 第210场周赛
Rank 挺简单的第三题被卡了,结果第四题没时间写,难受… A. 括号的最大嵌套深度 括号匹配,简单模拟. class Solution { public: int maxDepth(string s) { stack<char> st; int ans=0; for(char ch:s){ if(ch=='('){ st.push(ch); ans=原创 2020-10-11 16:12:10 · 285 阅读 · 0 评论 -
LeetCode - 第209场周赛
国庆放假,赛后补题. A. 特殊数组的特征值 简单模拟. class Solution { public: int specialArray(vector<int>& nums) { sort(nums.begin(),nums.end()); int n=nums.size(); for(int i=0;i<=n;++i){ int j=0; while(j<n &原创 2020-10-11 16:11:14 · 209 阅读 · 0 评论 -
LeetCode - 第36场双周赛
国庆放假,赛后补题. A. 设计停车系统 简单模拟. class ParkingSystem { public: int b,m,s; ParkingSystem(int big, int medium, int small) { b=big; m=medium; s=small; } bool addCar(int carType) { if(carType==1){ if(b){原创 2020-10-11 16:08:16 · 160 阅读 · 0 评论 -
LeetCode - 第208场周赛
Rank 国庆节补课,赛后补题,这周题比较简单. A. 文件夹操作日志搜集器 简单模拟. class Solution { public: int minOperations(vector<string>& logs) { int n=logs.size(); int ans=0; for(string log:logs){ if(log=="./") continue; if(lo原创 2020-09-27 16:11:16 · 148 阅读 · 0 评论 -
LeetCode - 第207场周赛
Rank 又翻车了… A. 重新排列单词间的空格 模拟. class Solution { public: string reorderSpaces(string text) { int len=text.size(); int cnt_word=0,cnt_blank=0; vector<string> words; for(int i=0;i<len;){ if(text[i]==' ')原创 2020-09-21 11:09:08 · 197 阅读 · 0 评论 -
LeetCode - 第35场双周赛
Rank A. 所有奇数长度子数组的和 暴力求解. class Solution { public: int sumOddLengthSubarrays(vector<int>& arr) { int n=arr.size(),ans=0; for(int i=0;i<n;++i){ for(int j=i;j<n;++j){ if((j-i+1)&1){原创 2020-09-20 00:21:02 · 231 阅读 · 0 评论 -
LCCUP - 2020秋季全国编程大赛(个人赛)
Rank A. 速算机器人 简单模拟. class Solution { public: int calculate(string s) { int x=1,y=0; for(char ch:s){ if(ch=='A'){ x=x*2+y; } else{ y=y*2+x; } }原创 2020-09-18 11:01:17 · 1393 阅读 · 0 评论 -
LeetCode - 第206场周赛
Rank A. 二进制矩阵中的特殊位置 暴力求解. class Solution { public: int numSpecial(vector<vector<int>>& mat) { int n=mat.size(); int m=mat[0].size(); int ans=0; for(int i=0;i<n;++i){ for(int j=0;j<m;++j原创 2020-09-14 23:06:30 · 166 阅读 · 0 评论
分享