Algorithm · Airbnb · Hard
Implement a function format_articles(articles, width) that takes an array of article strings articles and an integer width representing the maximum characters allowed per line. The function should wrap each article into lines according to the rules below, then return all lines as a single flat array, interleaving articles with a "----" separator. For each article, split its text into words (separated by single spaces). Greedily pack as many consecutive words as possible onto…
Checking your access…