Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Array Sequences/Amortization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
12 changes: 6 additions & 6 deletions Array Sequences/Array Mini-Project.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -86,9 +84,7 @@
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import collections\n",
Expand All @@ -114,9 +110,7 @@
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -167,9 +161,7 @@
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -209,9 +201,7 @@
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -250,23 +240,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Anagram Check\n",
"\n",
"## Problem\n",
"\n",
"Given two strings, check to see if they are anagrams. An anagram is when the two strings can be written using the exact same letters (so you can just rearrange the letters to get a different phrase or word). \n",
"\n",
"For example:\n",
"\n",
" \"public relations\" is an anagram of \"crap built on lies.\"\n",
" \n",
" \"clint eastwood\" is an anagram of \"old west action\"\n",
" \n",
"**Note: Ignore spaces and capitalization. So \"d go\" is an anagram of \"God\" and \"dog\" and \"o d g\".**\n",
"\n",
"## Solution\n",
"\n",
"Fill out your solution below:"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"def anagram(s1,s2):\n",
" '''\n",
" Tung practice\n",
" '''\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"anagram('dog','god')"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"anagram('clint eastwood','old west action')"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"anagram('aa','bb')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test Your Solution\n",
"Run the cell below to test your solution"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ALL TEST CASES PASSED\n"
]
}
],
"source": [
"\"\"\"\n",
"RUN THIS CELL TO TEST YOUR SOLUTION\n",
"\"\"\"\n",
"from nose.tools import assert_equal\n",
"\n",
"class AnagramTest(object):\n",
" \n",
" def test(self,sol):\n",
" assert_equal(sol('go go go','gggooo'),True)\n",
" assert_equal(sol('abc','cba'),True)\n",
" assert_equal(sol('hi man','hi man'),True)\n",
" assert_equal(sol('aabbcc','aabbc'),False)\n",
" assert_equal(sol('123','1 2'),False)\n",
" print \"ALL TEST CASES PASSED\"\n",
"\n",
"# Run Tests\n",
"t = AnagramTest()\n",
"t.test(anagram)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ALL TEST CASES PASSED\n"
]
}
],
"source": [
"t.test(anagram2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Good Job!"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Loading