题目来源:https://leetcode.com/problems/number-of-lines-to-write-string/description/
标记难度:Easy
提交次数:1/1
代码效率:100.00%
题意
有一个数组的元素,每个元素有一个宽度,需要把它们按顺序分成若干行,每一行的宽度最大为100,问至少需要多少行,最后一行的实际宽度是多少。
分析
超级大水题,直接模拟就行。
代码
1 |
class Solution { |
题目来源:https://leetcode.com/problems/number-of-lines-to-write-string/description/
标记难度:Easy
提交次数:1/1
代码效率:100.00%
有一个数组的元素,每个元素有一个宽度,需要把它们按顺序分成若干行,每一行的宽度最大为100,问至少需要多少行,最后一行的实际宽度是多少。
超级大水题,直接模拟就行。
1 |
class Solution { |
近期评论