Created
November 3, 2018 05:53
-
-
Save etrepum/e3941a7c3a0d6c06e38f989b361189ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"metadata": { | |
"trusted": true | |
}, | |
"cell_type": "code", | |
"source": "COUNTS = [\n 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, \n 24, 25, 26, 27, 28, 29, 30, 35, 40, 45, 50, 60, 70, 75, 80, 90, 100, 125, \n 150, 200\n]\n\nMEMO = dict((c, (c,)) for c in COUNTS)\n\ndef build_wing_table(min_wings=4, max_wings=1000):\n for i in range(min_wings, max_wings):\n # This is guaranteed to be present if the numbers can saturate the range\n v = MEMO[i]\n for k in COUNTS:\n MEMO.setdefault(i + k, (k,) + v)\n\nbuild_wing_table()\n\ndef compute_max_wing_order(start, end):\n return max(len(MEMO[i]) for i in range(start, end))\n\nprint('Max three digit wing order: {}'.format(compute_max_wing_order(100, 1000)))\n", | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": "Max three digit wing order: 7\n", | |
"name": "stdout" | |
} | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"name": "python36", | |
"display_name": "Python 3.6", | |
"language": "python" | |
}, | |
"language_info": { | |
"mimetype": "text/x-python", | |
"nbconvert_exporter": "python", | |
"name": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.6", | |
"file_extension": ".py", | |
"codemirror_mode": { | |
"version": 3, | |
"name": "ipython" | |
} | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment