Scan to open on your phone
Point a camera at the QR code - it opens this exact paste, no app needed.
https://codepastes.com/zzgrymsbk6tchsb0untitledJavaScript
q1 ← sort(frequencies); q2 ← empty
OPT ← 0
repeat N − 1 times:
a ← popMin(q1, q2)
b ← popMin(q1, q2)
q2.pushBack(a + b)
OPT ← OPT + a + b
154 chars · codepastes.com