Skip to content

raggedright

bradendubois edited this page Jun 9, 2021 · 6 revisions

Ragged Right

ID: raggedright

Difficulty: 1.9

CPU Time: 1 second

Memory: 1024 MB

Solution

Read in every line and store its length in some list, but also track the largest value seen so far. Then, do a pass through the list (not including the last value!) and calculate the "raggedness" of that line and add it to a total.

Clone this wiki locally