被坑集锦

leetcode 394. 字符串解码。
自增自减符号不要写在while循环的条件里,可能出现意料之外的bug

int main(){
int t = 3;
while (t --) // 不要这么写,当t减到0时,还是会执行一次0--,最后t为-1
{
cout << t << endl;
}
cout << t << endl;
return 0;
}
2
1
0
-1