problem
solution:
class Solution {public: vector numberOfLines(vector & widths, string S) { int line = 1, len = 0; for(auto ch:S) { int t = widths[ch-'a']; if(len+t>100) line++; len = (len+t>100) ? t : len+t; } return {line, len}; }};
参考
1. ;
2. ;
完