TorinPena
on Oct. 17, 2017, 1:44 p.m.
<p>While definitely simple, this also seems like a brute force solution. A smart one, but still brute force. And after a lot of mulling things over, brute force seems like the smartest method, especially for getting this code into so few lines. I did however figure out how to cut this code down to 5 lines with a(n admittedly lengthy) statement to replace the innermost for loop. </p>
<pre class='brush: python'>ret += list(map(lambda pos: min(historgram[pos:pos+width])*width, range(hlen-width+1)))
</pre>