报错
报错no viable overloaded '=';
```
ListNode f=head,s=head;
while(k--) f=f.next;//你试图用一个f结构体接收指针
```
报错non-void function does not return a value in all
```
class Solution {int n=0;
public:
int kthToLast(ListNode* head, int k) {
if(!head) return 0 ;
int val=kthToLast(head->next,k);
n++;
if(n<k){
return 0;
}
else if(n==k){
return head->val;
}
else if(n>k) return val;//这里使用了else if()而后面没有else了!! 一定要包含所有的情况否则编译不过!
}
};
```
##invalid operands to binary expression ('std::string' (aka 'basic_string<char>') and '__gnu_cxx::__alloc_traits<std::allocator<char>
```
string removeDuplicates(string s) {
stack<char> st;
for(auto i:s){//此处使用了auto对s操作希望能变成char类型,但是不可以这么操作,所以正确做法:for(char i:s)
if(st.empty()||i!=st.top()){
st.push(i);
}
else st.pop();
}
```
##error: no matching member function for call to 'insert' s.insert(s.begin()+i+1,","); //没有找到对应的函数 说明可能是你的参数写错哦了,下面会提示你,应该是什么
```
```