From: Neil Smith Date: Wed, 8 Mar 2017 14:09:13 +0000 (-0800) Subject: Added blurb and trusted notebooks X-Git-Url: https://git.njae.me.uk/?a=commitdiff_plain;h=d86fa55df646b2374b032f3cc435cd4d8ddabf39;p=ou-summer-of-code-2017.git Added blurb and trusted notebooks --- diff --git a/monotone-substrings/generate_sequence.ipynb b/monotone-substrings/generate_sequence.ipynb index 275fa88..83b8907 100644 --- a/monotone-substrings/generate_sequence.ipynb +++ b/monotone-substrings/generate_sequence.ipynb @@ -2104,7 +2104,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2+" + "version": "3.5.2" } }, "nbformat": 4, diff --git a/monotone-substrings/single_substring.ipynb b/monotone-substrings/single_substring.ipynb index 9fb7285..c800ab9 100644 --- a/monotone-substrings/single_substring.ipynb +++ b/monotone-substrings/single_substring.ipynb @@ -1,5 +1,33 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Monotone substrings\n", + "\n", + "Given a list of numbers, find the length of longest increasing or decreasing substring in the list.\n", + "\n", + "For instance, the sequence\n", + " 10, 1, 2, 3, 4, 5, 5, 5, 6, 4, 3, 5, 6\n", + "contains these increasing or decreasing substrings:\n", + "* 10, 1\n", + "* 1, 2, 3, 4, 5\n", + "* 5, 6\n", + "* 6, 4, 3\n", + "* 3, 5, 6\n", + "\n", + "As an extension, allow the substring to contain runs of identical numbers, each of which is included in the length of the longest substring.\n", + "\n", + "If identical numbers are allowed, the above sequence contains substrings:\n", + "* 10, 1\n", + "* 1, 2, 3, 4, 5, 5, 5, 6\n", + "* 6, 4, 3\n", + "* 3, 5, 6\n", + "\n", + "The list is given as a single line of comma-separated integers. " + ] + }, { "cell_type": "code", "execution_count": 1, @@ -119,7 +147,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 8, "metadata": { "collapsed": false }, @@ -147,7 +175,7 @@ "5" ] }, - "execution_count": 4, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -158,7 +186,47 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 2 False\t10\t>\t1\n", + " 2 True\t1\t<\t2\n", + " 3 True\t2\t<\t3\n", + " 4 True\t3\t<\t4\n", + " 5 True\t4\t<\t5\n", + " 1 True\t5\t=\t5\n", + " 1 True\t5\t=\t5\n", + " 2 True\t5\t<\t6\n", + " 2 False\t6\t>\t4\n", + " 3 False\t4\t>\t3\n", + " 2 True\t3\t<\t5\n", + " 3 True\t5\t<\t6\n" + ] + }, + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "longest_monotone([10,1,2,3,4,5,5,5,6,4,3,5,6], debug=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "metadata": { "collapsed": false }, @@ -174,8 +242,9 @@ " 5 True\t4\t<\t5\n", " 6 True\t5\t=\t5\n", " 7 True\t5\t=\t5\n", - " 4 False\t5\t>\t4\n", - " 5 False\t4\t>\t3\n", + " 8 True\t5\t<\t6\n", + " 2 False\t6\t>\t4\n", + " 3 False\t4\t>\t3\n", " 2 True\t3\t<\t5\n", " 3 True\t5\t<\t6\n" ] @@ -183,16 +252,16 @@ { "data": { "text/plain": [ - "7" + "8" ] }, - "execution_count": 5, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "longest_monotone([10,1,2,3,4,5,5,5,4,3,5,6], allow_same=True, debug=True)" + "longest_monotone([10,1,2,3,4,5,5,5,6,4,3,5,6], allow_same=True, debug=True)" ] }, { diff --git a/monotone-substrings/single_substring_itertools.ipynb b/monotone-substrings/single_substring_itertools.ipynb index 80c2d2a..1e0f20d 100644 --- a/monotone-substrings/single_substring_itertools.ipynb +++ b/monotone-substrings/single_substring_itertools.ipynb @@ -1,5 +1,33 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Monotone substrings\n", + "\n", + "Given a list of numbers, find the length of longest increasing or decreasing substring in the list.\n", + "\n", + "For instance, the sequence\n", + " 10, 1, 2, 3, 4, 5, 5, 5, 6, 4, 3, 5, 6\n", + "contains these increasing or decreasing substrings:\n", + "* 10, 1\n", + "* 1, 2, 3, 4, 5\n", + "* 5, 6\n", + "* 6, 4, 3\n", + "* 3, 5, 6\n", + "\n", + "As an extension, allow the substring to contain runs of identical numbers, each of which is included in the length of the longest substring.\n", + "\n", + "If identical numbers are allowed, the above sequence contains substrings:\n", + "* 10, 1\n", + "* 1, 2, 3, 4, 5, 5, 5, 6\n", + "* 6, 4, 3\n", + "* 3, 5, 6\n", + "\n", + "The list is given as a single line of comma-separated integers. " + ] + }, { "cell_type": "code", "execution_count": 1, diff --git a/wordsearch/wordsearch-creation.ipynb b/wordsearch/wordsearch-creation.ipynb index 4a70378..8a81e74 100644 --- a/wordsearch/wordsearch-creation.ipynb +++ b/wordsearch/wordsearch-creation.ipynb @@ -1337,7 +1337,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2+" + "version": "3.5.2" } }, "nbformat": 4, diff --git a/wordsearch/wordsearch-solving.ipynb b/wordsearch/wordsearch-solving.ipynb index 89b8637..b2c6c7e 100644 --- a/wordsearch/wordsearch-solving.ipynb +++ b/wordsearch/wordsearch-solving.ipynb @@ -1,5 +1,24 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Wordsearch\n", + "Given a text file, consisting of three parts (a grid size, a grid, and a list of words), find:\n", + "* the words present in the grid, \n", + "* the longest word present in the grid, \n", + "* the number of words not present in the grid, \n", + "* the longest word not present that can be formed from the leftover letters\n", + "\n", + "The only words that need be considered are the ones given in the list in the puzzle input.\n", + "\n", + "The puzzle consists of:\n", + "1. A line consisting of _w_`x`_h_, where _w_ and _h_ are integers giving the width and height of the grid.\n", + "2. The grid itself, consisting of _h_ lines each of _w_ letters.\n", + "3. A list of words, one word per line, of arbitrary length. " + ] + }, { "cell_type": "code", "execution_count": 13, @@ -1108,7 +1127,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2+" + "version": "3.5.2" } }, "nbformat": 4,