Distribute Strings into K Lines with Greedy Placement

Given a list of non-empty strings strings and an integer k (number of lines/buckets). Process the strings in order and assign each string to one line.

Part 1 (any placement)

  • Implement a met...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: