Problem 418: Sentence Screen Fitting

https://leetcode.com/problems/sentence-screen-fitting/

思路

复杂度

  • Time

    O(m+n)O(m + n)

    其中 m 是 rows,n 是 cols

易错点

  1. index[] 的计数是从 1 开始的

  2. String join 函数

    join 函数实际上,第一个 parameter 是分隔符,比如 “-”,这里我们用的是 space。也就是说,字符串数组里的元素会被 space 连接起来。

Last updated

Was this helpful?