- 博客(4)
- 收藏
- 关注
原创 【Leetcode】第201场周赛
A.整理字符串 解题思路: 多次遍历数组,将前后字符ASCII码差值为32的两个字符删除,直到本次遍历没有改变数组。 代码展示: class Solution { public: string makeGood(string s) { if(s.size()==0 || s.size()==1) return s; int i=0; while(1){ bool tmp=false; for(int i
2020-09-19 16:19:34
162
原创 【Leetcode】第200场周赛
title: 【Leetcode】第200场周赛 date: 2020-08-31 17:19:41 categories: Leetcode 周赛 tags: 贪心 深度优先遍历 A.统计好三元组 解题思路: 三重遍历所有情况。判断三元组是否满足条件。 代码展示: class Solution { public: int countGoodTriplets(vector<int>& arr, int a, int b, int c) { int ans=.
2020-09-01 08:54:52
183
原创 【Leetcode】第199场周赛
A.重新排列字符串 思路: 开个新数组或者map存储对应序号的字符,然后按序输出。 代码: class Solution { public: string restoreString(string s, vector<int>& indices) { map<int,char> q; for(int i=0;i<s.length();i++) q[indices[i]]=s[i]; stri
2020-07-28 10:34:46
205
原创 兰兰考研期间可以写的Leetcode
顺序表 1.删除排序数组中的重复项(easy) 链表 1.合并两个有序链表(easy) 2.删除链表的倒数第N个节点(mid)
2020-07-09 20:16:55
237
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅