Pregunta de entrevista de eBay

Basically is leetcode 68. Text Justification