SEND + MORE = MONEY: Difference between revisions

Content added Content deleted
m (→‎Fast: Add optimizations and timing)
(→‎{{header|Wren}}: More efficient.)
Line 294: Line 294:
for (or in ors) {
for (or in ors) {
if (send.contains(or[0]) || send.contains(or[1])) continue
if (send.contains(or[0]) || send.contains(or[1])) continue
var sendmore = send + or
var MORE = 1000 * m + 100 * or[0] + 10 * or[1] + send[1]
var MORE = 1000 * m + 100 * or[0] + 10 * or[1] + send[1]
for (y in digits) {
for (y in digits) {
if (sendmore.contains(y)) continue
if (send.contains(y) || or.contains(y)) continue
var MONEY = 10000 * m + 1000 * or[0] + 100 * send[2] + 10 * send[1] + y
var MONEY = 10000 * m + 1000 * or[0] + 100 * send[2] + 10 * send[1] + y
if (SEND + MORE == MONEY) {
if (SEND + MORE == MONEY) {
Line 312: Line 311:
9567 + 1085 = 10652
9567 + 1085 = 10652


Took 0.245002 seconds.
Took 0.051735 seconds.
</pre>
</pre>