class Solution {
public:
int leastBricks(vector<vector<int>>& wall) {
int n = wall.size();
int m;
//vector<int> tmp;
int tmp;
map<int,int> mymap; //记录次数
int maxt = 0; //记录最多次数
for(int i = 0; i < n; i++){
//tmp = wall[i];
m = wall[i].size();
tmp = 0;
for(int j = 0; j < m-1; j++){
tmp += wall[i][j];
mymap[tmp]++;
maxt = max(maxt, mymap[tmp]);
}
}
//printf("%d\n", maxt);
return n-maxt;
}
};