#include<iostream>#include<vector>classSolution{public:std::vector<int>partitionLabels(std::string s){int hash[26]{0};for(int i =0; i < s.size();++i)hash[s[i]-'a']= i;std::vector<int> result;int left =0, right =0;for(int i =0; i < s.size();++i){right = std::max(right, hash[s[i]-'a']);if(i == right){result.push_back(right - left +1);left = i +1;}}return result;}};intmain(){Solution s;return0;}
安装这三插件
vscode安装插件clangd 后报错 无法自动下载服务端
Failed to install clangd language server: FetchError: request to https://api.github.com/repos/clangd/clangd/releases/latest failed, reason: Failed to establish a socket connection to proxies…