社区一直支持Markdown语法和代码高亮哦。
比如单行代码:代码之间分别用一个反引号包起来。
`hello world`
多行代码(代码块):代码之间分别用三个反引号包起来,且两边的反引号单独占一行。
hello world
hello world
代码高亮:
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <queue>
using namespace std;
class Solution {
public:
int findShortestSubArray(vector<int>& nums) {
unordered_map<int, int> cnt;
for (auto d : nums){
cnt[d]++;
}
int maxCnt = 0;
for (auto it : cnt){
maxCnt = max(maxCnt, it.second);
}
//滑动窗口
int n = nums.size();
int res = n;
int l = 0;
int r = 0;
while (r < n){
int d = nums[r];
cnt[d]--;
while (cnt[d] == 0){
if (nums[l] == d){
break;
}
cnt[nums[l]]++;
l++;
}
if (cnt[d] == 0){
res = min(res, r - l + 1);
}
r++;
}
return res;
}
};
int main(){
return 0;
}
Markdown语法简单教程:
https://hostalk.net/posts/hexo_markdown.html