
August 15, 2010. Someone broadcasts a Bitcoin transaction that creates 184 billion coins out of thin air, far more than will ever exist. The exploit was two outputs with enormous amounts chosen so their sum overflowed the integer used to total them, wrapped around to a small number, and slipped straight past the check that outputs cannot exceed inputs. Satoshi patched it within hours and the chain was forked to erase it. It is the only time coins were ever conjured from a bug. Total the outputs without letting them wrap.
Objective
Return whether two outputs are valid: their sum must not overflow a signed 32-bit total.
Steps
$ sum_ok(1, 1)
1
$ sum_ok(2000000000, 2000000000)
0
$ sum_ok(2147483647, 0)
1
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...