题目
解法:
class Solution {
public:
vector<int> numberOfLines(vector<int>& widths, string s) {
int lines = 1;
int curr_line = 0;
for(auto& c : s){
curr_line += widths[c-'a'];
if(curr_line > 100){
lines++;
curr_line = widths[c-'a'];
}
}
return {lines,curr_line};
}
};