diff --git a/.project b/.project
deleted file mode 100644
index a8722310..00000000
--- a/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Python-for-Algorithm-and-Interviews
-
-
-
-
-
- org.python.pydev.PyDevBuilder
-
-
-
-
-
- org.python.pydev.pythonNature
-
-
diff --git a/.pydevproject b/.pydevproject
deleted file mode 100644
index d001f0ae..00000000
--- a/.pydevproject
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-Default
-python interpreter
-
diff --git a/03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/05-Implement-a-Queue-Using-Two-Stacks/05-Implement a Queue -Using Two Stacks - SOLUTION.ipynb b/03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/05-Implement-a-Queue-Using-Two-Stacks/05-Implement a Queue -Using Two Stacks - SOLUTION.ipynb
deleted file mode 100644
index 7e63cb58..00000000
--- a/03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/05-Implement-a-Queue-Using-Two-Stacks/05-Implement a Queue -Using Two Stacks - SOLUTION.ipynb
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Queue - Using Two Stacks - SOLUTION\n",
- "\n",
- "Given the Stack class below, implement a Queue class using **two** stacks! Note, this is a \"classic\" interview problem. Use a Python list data structure as your Stack."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "stack1 = []\n",
- "stack2 = []"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Solution\n",
- "\n",
- "The key insight is that a stack reverses order (while a queue doesn't). A sequence of elements pushed on a stack comes back in reversed order when popped. Consequently, two stacks chained together will return elements in the same order, since reversed order reversed again is original order.\n",
- "\n",
- " We use an in-stack that we fill when an element is enqueued and the dequeue operation takes elements from an out-stack. If the out-stack is empty we pop all elements from the in-stack and push them onto the out-stack. "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "class Queue2Stacks(object):\n",
- " \n",
- " def __init__(self):\n",
- " \n",
- " # Two Stacks\n",
- " self.instack = []\n",
- " self.outstack = []\n",
- " \n",
- " def enqueue(self,element):\n",
- " \n",
- " # Add an enqueue with the \"IN\" stack\n",
- " self.instack.append(element)\n",
- " \n",
- " def dequeue(self):\n",
- " if not self.outstack:\n",
- " while self.instack:\n",
- " # Add the elements to the outstack to reverse the order when called\n",
- " self.outstack.append(self.instack.pop())\n",
- " return self.outstack.pop() "
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Test Your Solution\n",
- "\n",
- "You should be able to tell with your current knowledge of Stacks and Queues if this is working as it should. For example, the following should print as such:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "0\n",
- "1\n",
- "2\n",
- "3\n",
- "4\n"
- ]
- }
- ],
- "source": [
- "\"\"\"\n",
- "RUN THIS CELL TO CHECK THAT YOUR SOLUTION OUTPUT MAKES SENSE AND BEHAVES AS A QUEUE\n",
- "\"\"\"\n",
- "q = Queue2Stacks()\n",
- "\n",
- "for i in range(5):\n",
- " q.enqueue(i)\n",
- " \n",
- "for i in range(5):\n",
- " print(q.dequeue())"
- ]
- },
- {
- "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.8.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/10-Mock Interviews/02-Large Search Engine Company /01-On-Site-Question-1/01-On-Site Question 1 - SOLUTION.ipynb b/10-Mock Interviews/02-Large Search Engine Company/01-On-Site-Question-1/01-On-Site Question 1 - SOLUTION.ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /01-On-Site-Question-1/01-On-Site Question 1 - SOLUTION.ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/01-On-Site-Question-1/01-On-Site Question 1 - SOLUTION.ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /01-On-Site-Question-1/01-On-Site Question 1 .ipynb b/10-Mock Interviews/02-Large Search Engine Company/01-On-Site-Question-1/01-On-Site Question 1 .ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /01-On-Site-Question-1/01-On-Site Question 1 .ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/01-On-Site-Question-1/01-On-Site Question 1 .ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /02-On-Site-Question-2/02-On-Site Question 2 - SOLUTION.ipynb b/10-Mock Interviews/02-Large Search Engine Company/02-On-Site-Question-2/02-On-Site Question 2 - SOLUTION.ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /02-On-Site-Question-2/02-On-Site Question 2 - SOLUTION.ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/02-On-Site-Question-2/02-On-Site Question 2 - SOLUTION.ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /02-On-Site-Question-2/02-On-Site Question 2 .ipynb b/10-Mock Interviews/02-Large Search Engine Company/02-On-Site-Question-2/02-On-Site Question 2 .ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /02-On-Site-Question-2/02-On-Site Question 2 .ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/02-On-Site-Question-2/02-On-Site Question 2 .ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /03-On-Site-Question-3/03-On-Site Question 3 -SOLUTION.ipynb b/10-Mock Interviews/02-Large Search Engine Company/03-On-Site-Question-3/03-On-Site Question 3 -SOLUTION.ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /03-On-Site-Question-3/03-On-Site Question 3 -SOLUTION.ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/03-On-Site-Question-3/03-On-Site Question 3 -SOLUTION.ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /03-On-Site-Question-3/03-On-Site Question 3 .ipynb b/10-Mock Interviews/02-Large Search Engine Company/03-On-Site-Question-3/03-On-Site Question 3 .ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /03-On-Site-Question-3/03-On-Site Question 3 .ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/03-On-Site-Question-3/03-On-Site Question 3 .ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /04-On-Site-Question-4/04-On-Site Question 4 - SOLUTION.ipynb b/10-Mock Interviews/02-Large Search Engine Company/04-On-Site-Question-4/04-On-Site Question 4 - SOLUTION.ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /04-On-Site-Question-4/04-On-Site Question 4 - SOLUTION.ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/04-On-Site-Question-4/04-On-Site Question 4 - SOLUTION.ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /04-On-Site-Question-4/04-On-Site Question 4 .ipynb b/10-Mock Interviews/02-Large Search Engine Company/04-On-Site-Question-4/04-On-Site Question 4 .ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /04-On-Site-Question-4/04-On-Site Question 4 .ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/04-On-Site-Question-4/04-On-Site Question 4 .ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /05-Phone-Screen/05-Phone Screen-Solutions.ipynb b/10-Mock Interviews/02-Large Search Engine Company/05-Phone-Screen/05-Phone Screen-Solutions.ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /05-Phone-Screen/05-Phone Screen-Solutions.ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/05-Phone-Screen/05-Phone Screen-Solutions.ipynb
diff --git a/10-Mock Interviews/02-Large Search Engine Company /05-Phone-Screen/05-Phone Screen.ipynb b/10-Mock Interviews/02-Large Search Engine Company/05-Phone-Screen/05-Phone Screen.ipynb
similarity index 100%
rename from 10-Mock Interviews/02-Large Search Engine Company /05-Phone-Screen/05-Phone Screen.ipynb
rename to 10-Mock Interviews/02-Large Search Engine Company/05-Phone-Screen/05-Phone Screen.ipynb
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 1 - SOLUTION-checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 1 - SOLUTION-checkpoint.ipynb
deleted file mode 100644
index df89907a..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 1 - SOLUTION-checkpoint.ipynb
+++ /dev/null
@@ -1,127 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 - SOLUTION\n",
- "___\n",
- "\n",
- "## Question\n",
- "** Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've solved it on pen and paper! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# SOLUTION\n",
- "\n",
- "This is a new problem we haven't seen directly before! Many times this question is asked in the form of functions e.g. your given a function random_7() and you have to take it as an input and create random_5()\n",
- "\n",
- "The key to solving this problem is to make sure you focus on the requirement that the final distribution of the rolls be uniform, also you were not given any requirements on Time and Space, so the solution is actually *very* simple, just keep re-rolling if you get a number greater than 5!\n",
- "\n",
- "We can code this out:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "from random import randint\n",
- " \n",
- "def dice7():\n",
- " return randint(1, 7)\n",
- " \n",
- "# Our Solution\n",
- "def convert7to5():\n",
- " \n",
- " # Starting roll (just needs to be larger than 5)\n",
- " roll = 7\n",
- " \n",
- " while roll > 5:\n",
- " \n",
- " roll = dice7()\n",
- " print 'dice7() produced a roll of ',roll\n",
- " print ' Your final returned roll is below:'\n",
- " return roll"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "dice7() produced a roll of 7\n",
- "dice7() produced a roll of 5\n",
- " Your final returned roll is below:\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "5"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "convert7to5()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Now, the next problem (On-Site Question 2) will be harder, the reverse conversion of rolls! This question should serve as a reminder not to overthink the solution to a question! Keep in mind that our solution has the potential to run for infinity if we keep rolling 6s and 7s (although this is highly unlikely).\n",
- "\n",
- "## Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 2 - SOLUTION-checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 2 - SOLUTION-checkpoint.ipynb
deleted file mode 100644
index 6d44e71a..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 2 - SOLUTION-checkpoint.ipynb
+++ /dev/null
@@ -1,149 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 - SOLUTION\n",
- "___\n",
- "\n",
- "## Question\n",
- "** Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice! **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've come up with a solution by hand! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# SOLUTION\n",
- "\n",
- "Because the 5 sided dice can not produce 7 possible outcomes on a single roll, we immediately know that we need to roll the dice at least twice. \n",
- "\n",
- "If we roll the dice twice we have 25 possible combinations of the results of the two rolls. While 25 is not divisible by 7, 21 is. This means we can implement our previous strategy of throwing out rolls not in our intended range.\n",
- "\n",
- "It's also important to note that we can't expand the solution to implement more rolls in order to not throw any out, because 5 and 7 are both prime which means that no exponent of 5 will be divisible by 7 no matter how high you go.\n",
- "\n",
- "We will define our range as a section of the 25 possible combinations of rolls. A good way to do this is by converting the two rolls into a unique outcome number in the range 1 through 25.\n",
- "\n",
- "We will create this number by taking the rolls, then we take the first roll and after subtracting 1 from it we multiply it by 4. Now the first roll corresponds with a value of 1 - 20.\n",
- "\n",
- "Then we take the second roll and add it to the result of the first manipulation. Giving us a range of 1-25.\n",
- "\n",
- "So our final solution is to roll the dice twice. Check the manipulated range from 1 to 25, if its greater than 21, do a reroll. Let's see it in action:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "from random import randint\n",
- " \n",
- "def dice5():\n",
- " return randint(1, 5)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Now for our conversion function:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 24,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "def convert5to7():\n",
- "\n",
- " # For constant re-roll purposes\n",
- " while True:\n",
- "\n",
- " # Roll the dice twice\n",
- " roll_1 = dice5()\n",
- " roll_2 = dice5()\n",
- " \n",
- " #print 'The rolls were {} and {}'.format(roll_1,roll_2)\n",
- "\n",
- " # Convert the combination to the range 1 to 25\n",
- " num = ( (roll_1-1) * 5 ) + ( roll_2 ) \n",
- "\n",
- " #print 'The converted range number was:',num\n",
- " if num > 21:\n",
- "\n",
- " # re-roll if we are out of range\n",
- " continue\n",
- "\n",
- " return num %7 + 1 "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 25,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "2"
- ]
- },
- "execution_count": 25,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "convert5to7()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 3 -SOLUTION-checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 3 -SOLUTION-checkpoint.ipynb
deleted file mode 100644
index 1e53ad72..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 3 -SOLUTION-checkpoint.ipynb
+++ /dev/null
@@ -1,91 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 - SOLUTION\n",
- "\n",
- "## Question\n",
- "\n",
- "**Given a string, write a function that uses recursion to reverse it. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "____"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# SOLUTION\n",
- "\n",
- "Hopefully you remember this problem, you've already seen it! The solution is:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def reverse(s):\n",
- " \n",
- " # Base Case\n",
- " if len(s) <= 1:\n",
- " return s\n",
- "\n",
- " # Recursion\n",
- " return reverse(s[1:]) + s[0]"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___\n",
- "## Notes\n",
- "\n",
- "Remember when recursion questions arise, think about the base case and the recursive case. Review the recusion section of the course for review for this problem."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 4 - SOLUTION-checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 4 - SOLUTION-checkpoint.ipynb
deleted file mode 100644
index 8c32f0a1..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 4 - SOLUTION-checkpoint.ipynb
+++ /dev/null
@@ -1,263 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 4 - SOLUTION\n",
- "\n",
- "## Question\n",
- "**Find the squareroot of a given number rounded down to the nearest integer, without using the sqrt function. For example, squareroot of a number between [9, 15] should return 3, and [16, 24] should be 4.**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Feel free to code this out (but its recommended that you use paper/pencil or whiteboard)**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "collapsed": true
- },
- "source": [
- "## Solution\n",
- "\n",
- "The squareroot of a (non-negative) number N always lies between 0 and N/2. The straightforward way to solve this problem would be to check every number k between 0 and N/2, until the square of k becomes greater than or rqual to N. If k^2 becomes equal to N, then we return k. Otherwise, we return k-1 because we're rounding down. Here's the code:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def solution(num): \n",
- " if num<0: \n",
- " raise ValueError \n",
- " if num==1: \n",
- " return 1 \n",
- " for k in range(1+(num/2)): \n",
- " if k**2==num: \n",
- " return k \n",
- " elif k**2>num: \n",
- " return k-1 \n",
- " return k "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "3"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "solution(14)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "3"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "solution(15)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "4"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "solution(16)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "The complexity of this approach is O(N), because we have to check N/2 numbers in the worst case. This linear algorithm is pretty inefficient, we can use some sort of binary search to speed it up. We know that the result is between 0 and N/2, so we can first try N/4 to see whether its square is less than, greater than, or equal to N. If it’s equal then we simply return that value. If it’s less, then we continue our search between N/4 and N/2. Otherwise if it’s greater, then we search between 0 and N/4. In both cases we reduce the potential range by half and continue, this is the logic of binary search. We’re not performing regular binary search though, it’s modified. We want to ensure that we stop at a number k, where k^2<=N but (k+1)^2>N. For example:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def better_solution(num): \n",
- " if num<0: \n",
- " raise ValueError \n",
- " if num==1: \n",
- " return 1 \n",
- " low=0 \n",
- " high=1+(num/2) \n",
- " \n",
- " while low+1\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "\n",
- "| Fib(n=15000) | \n",
- "
\n",
- "\n",
- "| loops | \n",
- "recursion | \n",
- "generators | \n",
- "memoization | \n",
- "memoization as decorator | \n",
- "
\n",
- "\n",
- "| 45 | \n",
- "87 | \n",
- "58 | \n",
- "44 | \n",
- "43 | \n",
- "
\n",
- "\n",
- "| 47 | \n",
- "88 | \n",
- "58 | \n",
- "42 | \n",
- "42 | \n",
- "
\n",
- "\n",
- "| 51 | \n",
- "92 | \n",
- "60 | \n",
- "44 | \n",
- "43 | \n",
- "
\n",
- "\n",
- "| 43 | \n",
- "87 | \n",
- "58 | \n",
- "42 | \n",
- "43 | \n",
- "
\n",
- "\n",
- "| 48 | \n",
- "92 | \n",
- "61 | \n",
- "42 | \n",
- "44 | \n",
- "
\n",
- "\n",
- "| 45 | \n",
- "87 | \n",
- "59 | \n",
- "43 | \n",
- "44 | \n",
- "
\n",
- "\n",
- "| 44 | \n",
- "85 | \n",
- "57 | \n",
- "42 | \n",
- "44 | \n",
- "
\n",
- "\n",
- "| 44 | \n",
- "87 | \n",
- "62 | \n",
- "43 | \n",
- "43 | \n",
- "
\n",
- "\n",
- "| 48 | \n",
- "86 | \n",
- "59 | \n",
- "42 | \n",
- "43 | \n",
- "
\n",
- "\n",
- "| 45 | \n",
- "91 | \n",
- "61 | \n",
- "45 | \n",
- "45 | \n",
- "
\n",
- "\n",
- "| 46 | \n",
- "88.2 | \n",
- "59.3 | \n",
- "42.9 | \n",
- "43.4 (Avg) | \n",
- "
\n",
- "\n",
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb
deleted file mode 100644
index c4514711..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 \n",
- "___\n",
- "\n",
- "## Question\n",
- "** Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've solved it on pen and paper! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb
deleted file mode 100644
index a63ca005..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 \n",
- "___\n",
- "\n",
- "## Question\n",
- "** Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice! **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've come up with a solution by hand! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb
deleted file mode 100644
index 49a04c0d..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 \n",
- "\n",
- "## Question\n",
- "\n",
- "**Given a string, write a function that uses recursion to reverse it. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "____"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 4 -checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 4 -checkpoint.ipynb
deleted file mode 100644
index d69bf130..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 4 -checkpoint.ipynb
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 4 \n",
- "\n",
- "## Question\n",
- "**Find the squareroot of a given number rounded down to the nearest integer, without using the sqrt function. For example, squareroot of a number between [9, 15] should return 3, and [16, 24] should be 4.**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Feel free to code this out (but its recommended that you use paper/pencil or whiteboard)**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/Phone Screen-checkpoint.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/Phone Screen-checkpoint.ipynb
deleted file mode 100644
index 8edb0203..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/Phone Screen-checkpoint.ipynb
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Phone Screen\n",
- "\n",
- "**This phone screen will consist of a non-technical series of questions about you and the company, and then a second half of a simple technical question to be coded out**\n",
- "___\n",
- "## Non-Technical Questions\n",
- "\n",
- "**Answer the following questions (2-5 minute responses) technical answers not required, more interested in hearing about your reasoning**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "* Give me some quick background about you (go over your resume)\n",
- "* Why do you want to work here?\n",
- "* What's your favorite programming language and why?\n",
- "* Where do you see yourself in 5 years?\n",
- "* Do you have any questions about the company for me?"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___\n",
- "## Technical Questions\n",
- "\n",
- "**Answer the following question in the *Markdown* cell below. It's important to note that the cell below does NOT have syntax highlighting, its common in a phone screen interview to be given a text editor hich doesn't have anything more than basic text support**\n",
- "\n",
- "1. Write a function that computes the Nth fibonacci number"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 1 .ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 1 .ipynb
deleted file mode 100644
index c4514711..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 1 .ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 \n",
- "___\n",
- "\n",
- "## Question\n",
- "** Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've solved it on pen and paper! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 2 .ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 2 .ipynb
deleted file mode 100644
index a63ca005..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 2 .ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 \n",
- "___\n",
- "\n",
- "## Question\n",
- "** Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice! **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST do this on pen and paper or on a whiteboard. No actual coding is allowed until you've come up with a solution by hand! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 3 .ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 3 .ipynb
deleted file mode 100644
index 49a04c0d..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 3 .ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 \n",
- "\n",
- "## Question\n",
- "\n",
- "**Given a string, write a function that uses recursion to reverse it. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "____"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 4 .ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 4 .ipynb
deleted file mode 100644
index d69bf130..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 4 .ipynb
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 4 \n",
- "\n",
- "## Question\n",
- "**Find the squareroot of a given number rounded down to the nearest integer, without using the sqrt function. For example, squareroot of a number between [9, 15] should return 3, and [16, 24] should be 4.**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Feel free to code this out (but its recommended that you use paper/pencil or whiteboard)**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/Phone Screen.ipynb b/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/Phone Screen.ipynb
deleted file mode 100644
index 8edb0203..00000000
--- a/Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/Phone Screen.ipynb
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Phone Screen\n",
- "\n",
- "**This phone screen will consist of a non-technical series of questions about you and the company, and then a second half of a simple technical question to be coded out**\n",
- "___\n",
- "## Non-Technical Questions\n",
- "\n",
- "**Answer the following questions (2-5 minute responses) technical answers not required, more interested in hearing about your reasoning**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "* Give me some quick background about you (go over your resume)\n",
- "* Why do you want to work here?\n",
- "* What's your favorite programming language and why?\n",
- "* Where do you see yourself in 5 years?\n",
- "* Do you have any questions about the company for me?"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "___\n",
- "## Technical Questions\n",
- "\n",
- "**Answer the following question in the *Markdown* cell below. It's important to note that the cell below does NOT have syntax highlighting, its common in a phone screen interview to be given a text editor hich doesn't have anything more than basic text support**\n",
- "\n",
- "1. Write a function that computes the Nth fibonacci number"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": []
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb
deleted file mode 100644
index ccfa72f7..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a list of integers, find the largest product you could make from 3 integers in the list **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You can assume that the list will always have at least 3 integers **\n",
- "\n",
- "** Paper/pencil only, don't code this out until you've solved it as far as you can by hand. **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb
deleted file mode 100644
index cd47095c..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Write a function that given a target amount of money and a list of possible coin denominations, returns the number of ways to make change for the target amount using the coin denominations**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Write out your work on paper/pencil, then see if you can code up your solution **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb
deleted file mode 100644
index 380ec415..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a binary tree, check whether it’s a binary search tree or not. **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Requirements\n",
- "\n",
- "** Use paper/pencil, do not code this in an IDE until you've done it manually**\n",
- "\n",
- "** Do not use built-in Python libraries to do this, but do mention them if you know about them **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb
deleted file mode 100644
index 062944af..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Phone Screen \n",
- "\n",
- "## Problem\n",
- "\n",
- "** If you were given a list of n integers and knew that they were sorted, how quickly could you check if a given integer was in the list? Elaborate on your reasoning and search methods in general**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Try explaining your solution to someone and see if it makes sense ot them. Don't code anything for this problem **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 1 .ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 1 .ipynb
deleted file mode 100644
index ccfa72f7..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 1 .ipynb
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a list of integers, find the largest product you could make from 3 integers in the list **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** You can assume that the list will always have at least 3 integers **\n",
- "\n",
- "** Paper/pencil only, don't code this out until you've solved it as far as you can by hand. **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 2 .ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 2 .ipynb
deleted file mode 100644
index cd47095c..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 2 .ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Write a function that given a target amount of money and a list of possible coin denominations, returns the number of ways to make change for the target amount using the coin denominations**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Write out your work on paper/pencil, then see if you can code up your solution **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 3 .ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 3 .ipynb
deleted file mode 100644
index 380ec415..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 3 .ipynb
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a binary tree, check whether it’s a binary search tree or not. **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Requirements\n",
- "\n",
- "** Use paper/pencil, do not code this in an IDE until you've done it manually**\n",
- "\n",
- "** Do not use built-in Python libraries to do this, but do mention them if you know about them **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/Phone Screen .ipynb b/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/Phone Screen .ipynb
deleted file mode 100644
index 062944af..00000000
--- a/Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/Phone Screen .ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Phone Screen \n",
- "\n",
- "## Problem\n",
- "\n",
- "** If you were given a list of n integers and knew that they were sorted, how quickly could you check if a given integer was in the list? Elaborate on your reasoning and search methods in general**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Try explaining your solution to someone and see if it makes sense ot them. Don't code anything for this problem **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1-checkpoint.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1-checkpoint.ipynb
deleted file mode 100644
index a72a4672..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1-checkpoint.ipynb
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a list of integers and a target number, write a function that returns a boolean indicating if its possible to sum two integers from the list to reach the target number **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Try pen/paper before coding out your solution **\n",
- "\n",
- "** You can not use an integer element twice. Optimize for time over space **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2-checkpoint.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2-checkpoint.ipynb
deleted file mode 100644
index e65f70c4..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2-checkpoint.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a list of account ID numbers (integers) which contains duplicates , find the one unique integer. (the list is guaranteed to only have one unique (non-duplicated) integer **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Do not use built-in Python functions or methods **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3-checkpoint.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3-checkpoint.ipynb
deleted file mode 100644
index 139bd6c5..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3-checkpoint.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Create a function that takes in a list of unsorted prices (integers) and a maximum possible price value, and return a sorted list of prices**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Your function should be able to perform this in less than O(nlogn) time. **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb
deleted file mode 100644
index d082e4e5..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Phone Screen \n",
- "\n",
- "## Problem \n",
- "\n",
- "** Remove duplicate characters in a given string keeping only the first occurrences. For example, if the input is ‘tree traversal’ the output will be ‘tre avsl’. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "**Complete this problem on a text editor that does not have syntax highlighting, such as a goolge doc!**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 1.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 1.ipynb
deleted file mode 100644
index a72a4672..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 1.ipynb
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 1 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a list of integers and a target number, write a function that returns a boolean indicating if its possible to sum two integers from the list to reach the target number **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Try pen/paper before coding out your solution **\n",
- "\n",
- "** You can not use an integer element twice. Optimize for time over space **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 2.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 2.ipynb
deleted file mode 100644
index e65f70c4..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 2.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 2 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Given a list of account ID numbers (integers) which contains duplicates , find the one unique integer. (the list is guaranteed to only have one unique (non-duplicated) integer **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Do not use built-in Python functions or methods **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 3.ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 3.ipynb
deleted file mode 100644
index 139bd6c5..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 3.ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# On-Site Question 3 \n",
- "\n",
- "## Problem\n",
- "\n",
- "** Create a function that takes in a list of unsorted prices (integers) and a maximum possible price value, and return a sorted list of prices**\n",
- "\n",
- "## Requirements\n",
- "\n",
- "** Your function should be able to perform this in less than O(nlogn) time. **"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/Phone Screen .ipynb b/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/Phone Screen .ipynb
deleted file mode 100644
index d082e4e5..00000000
--- a/Mock Interviews/Social Network Company/Social Network Company - Interview Questions/Phone Screen .ipynb
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Phone Screen \n",
- "\n",
- "## Problem \n",
- "\n",
- "** Remove duplicate characters in a given string keeping only the first occurrences. For example, if the input is ‘tree traversal’ the output will be ‘tre avsl’. **\n",
- "\n",
- "## Requirements\n",
- "\n",
- "**Complete this problem on a text editor that does not have syntax highlighting, such as a goolge doc!**"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Good Luck!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Practice.ipynb b/Practice.ipynb
deleted file mode 100644
index b2ecf2ed..00000000
--- a/Practice.ipynb
+++ /dev/null
@@ -1,1407 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "'HELLO'"
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "s = 'hello'\n",
- "s.upper()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "hi\n"
- ]
- }
- ],
- "source": [
- "set1 = set()\n",
- "print('hi')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "('hello',)"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "import timeit\n",
- "timeit\n",
- "singleton = 'hello',\n",
- "singleton"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "{'banana', 'apple', 'orange', 'pear'}\n"
- ]
- }
- ],
- "source": [
- "basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n",
- "print(type(basket))\n",
- "print(basket)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 15,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "{' ', 't', 's', 'i', 'h', 'o', 'e', 'n', 'm', 'g'}\n"
- ]
- }
- ],
- "source": [
- "chars = {c for c in 'this is something'}\n",
- "print(chars)\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 57,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "True"
- ]
- },
- "execution_count": 57,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "s = 'A man, a plan, a canal: Panama'\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 66,
- "metadata": {},
- "outputs": [
- {
- "ename": "SyntaxError",
- "evalue": "'return' outside function (, line 7)",
- "output_type": "error",
- "traceback": [
- "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m7\u001b[0m\n\u001b[0;31m return False\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m 'return' outside function\n"
- ]
- }
- ],
- "source": [
- "s='ab'\n",
- "s=s.casefold()\n",
- "chars = list(filter(lambda c:c.isalpha(), s))\n",
- "low, high=0, len(chars)-1\n",
- "while(low>> a_string = 'amanaplanacanalpanama' * 10\n",
- ">>> min(timeit.repeat(lambda: reverse_string_readable_answer(a_string)))\n",
- "10.38789987564087\n",
- ">>> min(timeit.repeat(lambda: reversed_string(a_string)))\n",
- "0.6622700691223145\n",
- ">>> min(timeit.repeat(lambda: reverse_a_string_slowly(a_string)))\n",
- "25.756799936294556\n",
- ">>> min(timeit.repeat(lambda: reverse_a_string_more_slowly(a_string)))\n",
- "38.73570013046265"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 23,
- "metadata": {},
- "outputs": [],
- "source": [
- "s = 'amanaplanacanalpanama'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 24,
- "metadata": {},
- "outputs": [],
- "source": [
- "\n",
- "def reverse_simple(s):\n",
- " return s[::-1]\n",
- "def reverse_readable(s):\n",
- " return ''.join(reversed(s))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 32,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "0.00010040099732577801"
- ]
- },
- "execution_count": 32,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "import timeit\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 44,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "0.9958420610055327"
- ]
- },
- "execution_count": 44,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": 48,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "1.6800561340060085"
- ]
- },
- "execution_count": 48,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "timeit.timeit('\"amanaplanacanalpanama\"[::-1]', number=10000000)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 49,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "9.636620013043284"
- ]
- },
- "execution_count": 49,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "timeit.timeit('\"\".join(reversed(\"amanaplanacanalpanama\"))', number=10000000)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "/Users/bin/Documents/Workspace/GitHub/Python-for-Algorithm-and-Interviews\r\n"
- ]
- }
- ],
- "source": [
- "!pwd"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "!say 'hi'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "ename": "ValueError",
- "evalue": "stmt is neither a string nor callable",
- "output_type": "error",
- "traceback": [
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
- "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtimeit\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtimeit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mn\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mn\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mnumber\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1000\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
- "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/timeit.py\u001b[0m in \u001b[0;36mtimeit\u001b[0;34m(stmt, setup, timer, number, globals)\u001b[0m\n\u001b[1;32m 231\u001b[0m number=default_number, globals=None):\n\u001b[1;32m 232\u001b[0m \u001b[0;34m\"\"\"Convenience function to create Timer object and call timeit method.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 233\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mTimer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msetup\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mglobals\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtimeit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnumber\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 234\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 235\u001b[0m def repeat(stmt=\"pass\", setup=\"pass\", timer=default_timer,\n",
- "\u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/timeit.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, stmt, setup, timer, globals)\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[0mstmt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'_stmt()'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 129\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 130\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"stmt is neither a string nor callable\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 131\u001b[0m \u001b[0msrc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtemplate\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstmt\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msetup\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msetup\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minit\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minit\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 132\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msrc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msrc\u001b[0m \u001b[0;31m# Save for traceback display\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
- "\u001b[0;31mValueError\u001b[0m: stmt is neither a string nor callable"
- ]
- }
- ],
- "source": [
- "timeit.timeit(,number=1000)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[0,\n",
- " 2,\n",
- " 4,\n",
- " 6,\n",
- " 8,\n",
- " 10,\n",
- " 12,\n",
- " 14,\n",
- " 16,\n",
- " 18,\n",
- " 20,\n",
- " 22,\n",
- " 24,\n",
- " 26,\n",
- " 28,\n",
- " 30,\n",
- " 32,\n",
- " 34,\n",
- " 36,\n",
- " 38,\n",
- " 40,\n",
- " 42,\n",
- " 44,\n",
- " 46,\n",
- " 48,\n",
- " 50,\n",
- " 52,\n",
- " 54,\n",
- " 56,\n",
- " 58,\n",
- " 60,\n",
- " 62,\n",
- " 64,\n",
- " 66,\n",
- " 68,\n",
- " 70,\n",
- " 72,\n",
- " 74,\n",
- " 76,\n",
- " 78,\n",
- " 80,\n",
- " 82,\n",
- " 84,\n",
- " 86,\n",
- " 88,\n",
- " 90,\n",
- " 92,\n",
- " 94,\n",
- " 96,\n",
- " 98,\n",
- " 100,\n",
- " 102,\n",
- " 104,\n",
- " 106,\n",
- " 108,\n",
- " 110,\n",
- " 112,\n",
- " 114,\n",
- " 116,\n",
- " 118,\n",
- " 120,\n",
- " 122,\n",
- " 124,\n",
- " 126,\n",
- " 128,\n",
- " 130,\n",
- " 132,\n",
- " 134,\n",
- " 136,\n",
- " 138,\n",
- " 140,\n",
- " 142,\n",
- " 144,\n",
- " 146,\n",
- " 148,\n",
- " 150,\n",
- " 152,\n",
- " 154,\n",
- " 156,\n",
- " 158,\n",
- " 160,\n",
- " 162,\n",
- " 164,\n",
- " 166,\n",
- " 168,\n",
- " 170,\n",
- " 172,\n",
- " 174,\n",
- " 176,\n",
- " 178,\n",
- " 180,\n",
- " 182,\n",
- " 184,\n",
- " 186,\n",
- " 188,\n",
- " 190,\n",
- " 192,\n",
- " 194,\n",
- " 196,\n",
- " 198,\n",
- " 200,\n",
- " 202,\n",
- " 204,\n",
- " 206,\n",
- " 208,\n",
- " 210,\n",
- " 212,\n",
- " 214,\n",
- " 216,\n",
- " 218,\n",
- " 220,\n",
- " 222,\n",
- " 224,\n",
- " 226,\n",
- " 228,\n",
- " 230,\n",
- " 232,\n",
- " 234,\n",
- " 236,\n",
- " 238,\n",
- " 240,\n",
- " 242,\n",
- " 244,\n",
- " 246,\n",
- " 248,\n",
- " 250,\n",
- " 252,\n",
- " 254,\n",
- " 256,\n",
- " 258,\n",
- " 260,\n",
- " 262,\n",
- " 264,\n",
- " 266,\n",
- " 268,\n",
- " 270,\n",
- " 272,\n",
- " 274,\n",
- " 276,\n",
- " 278,\n",
- " 280,\n",
- " 282,\n",
- " 284,\n",
- " 286,\n",
- " 288,\n",
- " 290,\n",
- " 292,\n",
- " 294,\n",
- " 296,\n",
- " 298,\n",
- " 300,\n",
- " 302,\n",
- " 304,\n",
- " 306,\n",
- " 308,\n",
- " 310,\n",
- " 312,\n",
- " 314,\n",
- " 316,\n",
- " 318,\n",
- " 320,\n",
- " 322,\n",
- " 324,\n",
- " 326,\n",
- " 328,\n",
- " 330,\n",
- " 332,\n",
- " 334,\n",
- " 336,\n",
- " 338,\n",
- " 340,\n",
- " 342,\n",
- " 344,\n",
- " 346,\n",
- " 348,\n",
- " 350,\n",
- " 352,\n",
- " 354,\n",
- " 356,\n",
- " 358,\n",
- " 360,\n",
- " 362,\n",
- " 364,\n",
- " 366,\n",
- " 368,\n",
- " 370,\n",
- " 372,\n",
- " 374,\n",
- " 376,\n",
- " 378,\n",
- " 380,\n",
- " 382,\n",
- " 384,\n",
- " 386,\n",
- " 388,\n",
- " 390,\n",
- " 392,\n",
- " 394,\n",
- " 396,\n",
- " 398,\n",
- " 400,\n",
- " 402,\n",
- " 404,\n",
- " 406,\n",
- " 408,\n",
- " 410,\n",
- " 412,\n",
- " 414,\n",
- " 416,\n",
- " 418,\n",
- " 420,\n",
- " 422,\n",
- " 424,\n",
- " 426,\n",
- " 428,\n",
- " 430,\n",
- " 432,\n",
- " 434,\n",
- " 436,\n",
- " 438,\n",
- " 440,\n",
- " 442,\n",
- " 444,\n",
- " 446,\n",
- " 448,\n",
- " 450,\n",
- " 452,\n",
- " 454,\n",
- " 456,\n",
- " 458,\n",
- " 460,\n",
- " 462,\n",
- " 464,\n",
- " 466,\n",
- " 468,\n",
- " 470,\n",
- " 472,\n",
- " 474,\n",
- " 476,\n",
- " 478,\n",
- " 480,\n",
- " 482,\n",
- " 484,\n",
- " 486,\n",
- " 488,\n",
- " 490,\n",
- " 492,\n",
- " 494,\n",
- " 496,\n",
- " 498,\n",
- " 500,\n",
- " 502,\n",
- " 504,\n",
- " 506,\n",
- " 508,\n",
- " 510,\n",
- " 512,\n",
- " 514,\n",
- " 516,\n",
- " 518,\n",
- " 520,\n",
- " 522,\n",
- " 524,\n",
- " 526,\n",
- " 528,\n",
- " 530,\n",
- " 532,\n",
- " 534,\n",
- " 536,\n",
- " 538,\n",
- " 540,\n",
- " 542,\n",
- " 544,\n",
- " 546,\n",
- " 548,\n",
- " 550,\n",
- " 552,\n",
- " 554,\n",
- " 556,\n",
- " 558,\n",
- " 560,\n",
- " 562,\n",
- " 564,\n",
- " 566,\n",
- " 568,\n",
- " 570,\n",
- " 572,\n",
- " 574,\n",
- " 576,\n",
- " 578,\n",
- " 580,\n",
- " 582,\n",
- " 584,\n",
- " 586,\n",
- " 588,\n",
- " 590,\n",
- " 592,\n",
- " 594,\n",
- " 596,\n",
- " 598,\n",
- " 600,\n",
- " 602,\n",
- " 604,\n",
- " 606,\n",
- " 608,\n",
- " 610,\n",
- " 612,\n",
- " 614,\n",
- " 616,\n",
- " 618,\n",
- " 620,\n",
- " 622,\n",
- " 624,\n",
- " 626,\n",
- " 628,\n",
- " 630,\n",
- " 632,\n",
- " 634,\n",
- " 636,\n",
- " 638,\n",
- " 640,\n",
- " 642,\n",
- " 644,\n",
- " 646,\n",
- " 648,\n",
- " 650,\n",
- " 652,\n",
- " 654,\n",
- " 656,\n",
- " 658,\n",
- " 660,\n",
- " 662,\n",
- " 664,\n",
- " 666,\n",
- " 668,\n",
- " 670,\n",
- " 672,\n",
- " 674,\n",
- " 676,\n",
- " 678,\n",
- " 680,\n",
- " 682,\n",
- " 684,\n",
- " 686,\n",
- " 688,\n",
- " 690,\n",
- " 692,\n",
- " 694,\n",
- " 696,\n",
- " 698,\n",
- " 700,\n",
- " 702,\n",
- " 704,\n",
- " 706,\n",
- " 708,\n",
- " 710,\n",
- " 712,\n",
- " 714,\n",
- " 716,\n",
- " 718,\n",
- " 720,\n",
- " 722,\n",
- " 724,\n",
- " 726,\n",
- " 728,\n",
- " 730,\n",
- " 732,\n",
- " 734,\n",
- " 736,\n",
- " 738,\n",
- " 740,\n",
- " 742,\n",
- " 744,\n",
- " 746,\n",
- " 748,\n",
- " 750,\n",
- " 752,\n",
- " 754,\n",
- " 756,\n",
- " 758,\n",
- " 760,\n",
- " 762,\n",
- " 764,\n",
- " 766,\n",
- " 768,\n",
- " 770,\n",
- " 772,\n",
- " 774,\n",
- " 776,\n",
- " 778,\n",
- " 780,\n",
- " 782,\n",
- " 784,\n",
- " 786,\n",
- " 788,\n",
- " 790,\n",
- " 792,\n",
- " 794,\n",
- " 796,\n",
- " 798,\n",
- " 800,\n",
- " 802,\n",
- " 804,\n",
- " 806,\n",
- " 808,\n",
- " 810,\n",
- " 812,\n",
- " 814,\n",
- " 816,\n",
- " 818,\n",
- " 820,\n",
- " 822,\n",
- " 824,\n",
- " 826,\n",
- " 828,\n",
- " 830,\n",
- " 832,\n",
- " 834,\n",
- " 836,\n",
- " 838,\n",
- " 840,\n",
- " 842,\n",
- " 844,\n",
- " 846,\n",
- " 848,\n",
- " 850,\n",
- " 852,\n",
- " 854,\n",
- " 856,\n",
- " 858,\n",
- " 860,\n",
- " 862,\n",
- " 864,\n",
- " 866,\n",
- " 868,\n",
- " 870,\n",
- " 872,\n",
- " 874,\n",
- " 876,\n",
- " 878,\n",
- " 880,\n",
- " 882,\n",
- " 884,\n",
- " 886,\n",
- " 888,\n",
- " 890,\n",
- " 892,\n",
- " 894,\n",
- " 896,\n",
- " 898,\n",
- " 900,\n",
- " 902,\n",
- " 904,\n",
- " 906,\n",
- " 908,\n",
- " 910,\n",
- " 912,\n",
- " 914,\n",
- " 916,\n",
- " 918,\n",
- " 920,\n",
- " 922,\n",
- " 924,\n",
- " 926,\n",
- " 928,\n",
- " 930,\n",
- " 932,\n",
- " 934,\n",
- " 936,\n",
- " 938,\n",
- " 940,\n",
- " 942,\n",
- " 944,\n",
- " 946,\n",
- " 948,\n",
- " 950,\n",
- " 952,\n",
- " 954,\n",
- " 956,\n",
- " 958,\n",
- " 960,\n",
- " 962,\n",
- " 964,\n",
- " 966,\n",
- " 968,\n",
- " 970,\n",
- " 972,\n",
- " 974,\n",
- " 976,\n",
- " 978,\n",
- " 980,\n",
- " 982,\n",
- " 984,\n",
- " 986,\n",
- " 988,\n",
- " 990,\n",
- " 992,\n",
- " 994,\n",
- " 996,\n",
- " 998,\n",
- " 1000,\n",
- " 1002,\n",
- " 1004,\n",
- " 1006,\n",
- " 1008,\n",
- " 1010,\n",
- " 1012,\n",
- " 1014,\n",
- " 1016,\n",
- " 1018,\n",
- " 1020,\n",
- " 1022,\n",
- " 1024,\n",
- " 1026,\n",
- " 1028,\n",
- " 1030,\n",
- " 1032,\n",
- " 1034,\n",
- " 1036,\n",
- " 1038,\n",
- " 1040,\n",
- " 1042,\n",
- " 1044,\n",
- " 1046,\n",
- " 1048,\n",
- " 1050,\n",
- " 1052,\n",
- " 1054,\n",
- " 1056,\n",
- " 1058,\n",
- " 1060,\n",
- " 1062,\n",
- " 1064,\n",
- " 1066,\n",
- " 1068,\n",
- " 1070,\n",
- " 1072,\n",
- " 1074,\n",
- " 1076,\n",
- " 1078,\n",
- " 1080,\n",
- " 1082,\n",
- " 1084,\n",
- " 1086,\n",
- " 1088,\n",
- " 1090,\n",
- " 1092,\n",
- " 1094,\n",
- " 1096,\n",
- " 1098,\n",
- " 1100,\n",
- " 1102,\n",
- " 1104,\n",
- " 1106,\n",
- " 1108,\n",
- " 1110,\n",
- " 1112,\n",
- " 1114,\n",
- " 1116,\n",
- " 1118,\n",
- " 1120,\n",
- " 1122,\n",
- " 1124,\n",
- " 1126,\n",
- " 1128,\n",
- " 1130,\n",
- " 1132,\n",
- " 1134,\n",
- " 1136,\n",
- " 1138,\n",
- " 1140,\n",
- " 1142,\n",
- " 1144,\n",
- " 1146,\n",
- " 1148,\n",
- " 1150,\n",
- " 1152,\n",
- " 1154,\n",
- " 1156,\n",
- " 1158,\n",
- " 1160,\n",
- " 1162,\n",
- " 1164,\n",
- " 1166,\n",
- " 1168,\n",
- " 1170,\n",
- " 1172,\n",
- " 1174,\n",
- " 1176,\n",
- " 1178,\n",
- " 1180,\n",
- " 1182,\n",
- " 1184,\n",
- " 1186,\n",
- " 1188,\n",
- " 1190,\n",
- " 1192,\n",
- " 1194,\n",
- " 1196,\n",
- " 1198,\n",
- " 1200,\n",
- " 1202,\n",
- " 1204,\n",
- " 1206,\n",
- " 1208,\n",
- " 1210,\n",
- " 1212,\n",
- " 1214,\n",
- " 1216,\n",
- " 1218,\n",
- " 1220,\n",
- " 1222,\n",
- " 1224,\n",
- " 1226,\n",
- " 1228,\n",
- " 1230,\n",
- " 1232,\n",
- " 1234,\n",
- " 1236,\n",
- " 1238,\n",
- " 1240,\n",
- " 1242,\n",
- " 1244,\n",
- " 1246,\n",
- " 1248,\n",
- " 1250,\n",
- " 1252,\n",
- " 1254,\n",
- " 1256,\n",
- " 1258,\n",
- " 1260,\n",
- " 1262,\n",
- " 1264,\n",
- " 1266,\n",
- " 1268,\n",
- " 1270,\n",
- " 1272,\n",
- " 1274,\n",
- " 1276,\n",
- " 1278,\n",
- " 1280,\n",
- " 1282,\n",
- " 1284,\n",
- " 1286,\n",
- " 1288,\n",
- " 1290,\n",
- " 1292,\n",
- " 1294,\n",
- " 1296,\n",
- " 1298,\n",
- " 1300,\n",
- " 1302,\n",
- " 1304,\n",
- " 1306,\n",
- " 1308,\n",
- " 1310,\n",
- " 1312,\n",
- " 1314,\n",
- " 1316,\n",
- " 1318,\n",
- " 1320,\n",
- " 1322,\n",
- " 1324,\n",
- " 1326,\n",
- " 1328,\n",
- " 1330,\n",
- " 1332,\n",
- " 1334,\n",
- " 1336,\n",
- " 1338,\n",
- " 1340,\n",
- " 1342,\n",
- " 1344,\n",
- " 1346,\n",
- " 1348,\n",
- " 1350,\n",
- " 1352,\n",
- " 1354,\n",
- " 1356,\n",
- " 1358,\n",
- " 1360,\n",
- " 1362,\n",
- " 1364,\n",
- " 1366,\n",
- " 1368,\n",
- " 1370,\n",
- " 1372,\n",
- " 1374,\n",
- " 1376,\n",
- " 1378,\n",
- " 1380,\n",
- " 1382,\n",
- " 1384,\n",
- " 1386,\n",
- " 1388,\n",
- " 1390,\n",
- " 1392,\n",
- " 1394,\n",
- " 1396,\n",
- " 1398,\n",
- " 1400,\n",
- " 1402,\n",
- " 1404,\n",
- " 1406,\n",
- " 1408,\n",
- " 1410,\n",
- " 1412,\n",
- " 1414,\n",
- " 1416,\n",
- " 1418,\n",
- " 1420,\n",
- " 1422,\n",
- " 1424,\n",
- " 1426,\n",
- " 1428,\n",
- " 1430,\n",
- " 1432,\n",
- " 1434,\n",
- " 1436,\n",
- " 1438,\n",
- " 1440,\n",
- " 1442,\n",
- " 1444,\n",
- " 1446,\n",
- " 1448,\n",
- " 1450,\n",
- " 1452,\n",
- " 1454,\n",
- " 1456,\n",
- " 1458,\n",
- " 1460,\n",
- " 1462,\n",
- " 1464,\n",
- " 1466,\n",
- " 1468,\n",
- " 1470,\n",
- " 1472,\n",
- " 1474,\n",
- " 1476,\n",
- " 1478,\n",
- " 1480,\n",
- " 1482,\n",
- " 1484,\n",
- " 1486,\n",
- " 1488,\n",
- " 1490,\n",
- " 1492,\n",
- " 1494,\n",
- " 1496,\n",
- " 1498,\n",
- " 1500,\n",
- " 1502,\n",
- " 1504,\n",
- " 1506,\n",
- " 1508,\n",
- " 1510,\n",
- " 1512,\n",
- " 1514,\n",
- " 1516,\n",
- " 1518,\n",
- " 1520,\n",
- " 1522,\n",
- " 1524,\n",
- " 1526,\n",
- " 1528,\n",
- " 1530,\n",
- " 1532,\n",
- " 1534,\n",
- " 1536,\n",
- " 1538,\n",
- " 1540,\n",
- " 1542,\n",
- " 1544,\n",
- " 1546,\n",
- " 1548,\n",
- " 1550,\n",
- " 1552,\n",
- " 1554,\n",
- " 1556,\n",
- " 1558,\n",
- " 1560,\n",
- " 1562,\n",
- " 1564,\n",
- " 1566,\n",
- " 1568,\n",
- " 1570,\n",
- " 1572,\n",
- " 1574,\n",
- " 1576,\n",
- " 1578,\n",
- " 1580,\n",
- " 1582,\n",
- " 1584,\n",
- " 1586,\n",
- " 1588,\n",
- " 1590,\n",
- " 1592,\n",
- " 1594,\n",
- " 1596,\n",
- " 1598,\n",
- " 1600,\n",
- " 1602,\n",
- " 1604,\n",
- " 1606,\n",
- " 1608,\n",
- " 1610,\n",
- " 1612,\n",
- " 1614,\n",
- " 1616,\n",
- " 1618,\n",
- " 1620,\n",
- " 1622,\n",
- " 1624,\n",
- " 1626,\n",
- " 1628,\n",
- " 1630,\n",
- " 1632,\n",
- " 1634,\n",
- " 1636,\n",
- " 1638,\n",
- " 1640,\n",
- " 1642,\n",
- " 1644,\n",
- " 1646,\n",
- " 1648,\n",
- " 1650,\n",
- " 1652,\n",
- " 1654,\n",
- " 1656,\n",
- " 1658,\n",
- " 1660,\n",
- " 1662,\n",
- " 1664,\n",
- " 1666,\n",
- " 1668,\n",
- " 1670,\n",
- " 1672,\n",
- " 1674,\n",
- " 1676,\n",
- " 1678,\n",
- " 1680,\n",
- " 1682,\n",
- " 1684,\n",
- " 1686,\n",
- " 1688,\n",
- " 1690,\n",
- " 1692,\n",
- " 1694,\n",
- " 1696,\n",
- " 1698,\n",
- " 1700,\n",
- " 1702,\n",
- " 1704,\n",
- " 1706,\n",
- " 1708,\n",
- " 1710,\n",
- " 1712,\n",
- " 1714,\n",
- " 1716,\n",
- " 1718,\n",
- " 1720,\n",
- " 1722,\n",
- " 1724,\n",
- " 1726,\n",
- " 1728,\n",
- " 1730,\n",
- " 1732,\n",
- " 1734,\n",
- " 1736,\n",
- " 1738,\n",
- " 1740,\n",
- " 1742,\n",
- " 1744,\n",
- " 1746,\n",
- " 1748,\n",
- " 1750,\n",
- " 1752,\n",
- " 1754,\n",
- " 1756,\n",
- " 1758,\n",
- " 1760,\n",
- " 1762,\n",
- " 1764,\n",
- " 1766,\n",
- " 1768,\n",
- " 1770,\n",
- " 1772,\n",
- " 1774,\n",
- " 1776,\n",
- " 1778,\n",
- " 1780,\n",
- " 1782,\n",
- " 1784,\n",
- " 1786,\n",
- " 1788,\n",
- " 1790,\n",
- " 1792,\n",
- " 1794,\n",
- " 1796,\n",
- " 1798,\n",
- " 1800,\n",
- " 1802,\n",
- " 1804,\n",
- " 1806,\n",
- " 1808,\n",
- " 1810,\n",
- " 1812,\n",
- " 1814,\n",
- " 1816,\n",
- " 1818,\n",
- " 1820,\n",
- " 1822,\n",
- " 1824,\n",
- " 1826,\n",
- " 1828,\n",
- " 1830,\n",
- " 1832,\n",
- " 1834,\n",
- " 1836,\n",
- " 1838,\n",
- " 1840,\n",
- " 1842,\n",
- " 1844,\n",
- " 1846,\n",
- " 1848,\n",
- " 1850,\n",
- " 1852,\n",
- " 1854,\n",
- " 1856,\n",
- " 1858,\n",
- " 1860,\n",
- " 1862,\n",
- " 1864,\n",
- " 1866,\n",
- " 1868,\n",
- " 1870,\n",
- " 1872,\n",
- " 1874,\n",
- " 1876,\n",
- " 1878,\n",
- " 1880,\n",
- " 1882,\n",
- " 1884,\n",
- " 1886,\n",
- " 1888,\n",
- " 1890,\n",
- " 1892,\n",
- " 1894,\n",
- " 1896,\n",
- " 1898,\n",
- " 1900,\n",
- " 1902,\n",
- " 1904,\n",
- " 1906,\n",
- " 1908,\n",
- " 1910,\n",
- " 1912,\n",
- " 1914,\n",
- " 1916,\n",
- " 1918,\n",
- " 1920,\n",
- " 1922,\n",
- " 1924,\n",
- " 1926,\n",
- " 1928,\n",
- " 1930,\n",
- " 1932,\n",
- " 1934,\n",
- " 1936,\n",
- " 1938,\n",
- " 1940,\n",
- " 1942,\n",
- " 1944,\n",
- " 1946,\n",
- " 1948,\n",
- " 1950,\n",
- " 1952,\n",
- " 1954,\n",
- " 1956,\n",
- " 1958,\n",
- " 1960,\n",
- " 1962,\n",
- " 1964,\n",
- " 1966,\n",
- " 1968,\n",
- " 1970,\n",
- " 1972,\n",
- " 1974,\n",
- " 1976,\n",
- " 1978,\n",
- " 1980,\n",
- " 1982,\n",
- " 1984,\n",
- " 1986,\n",
- " 1988,\n",
- " 1990,\n",
- " 1992,\n",
- " 1994,\n",
- " 1996,\n",
- " 1998]"
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "import timeit\n",
- "[2 * n for n in range(1000)]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "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.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/README.md b/README.md
deleted file mode 100644
index 71dea9b5..00000000
--- a/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Python for Algorithms, Data-Structures, and Interviews!
-#### Welcome to the repository for the Udemy Course: Python for Algorithms, Data Structures, and Interviews!
-
-This is the ultimate course in preparing you for your technical interviews and landing the job of your dreams!
-
-Get the entire course, including full video content, solution walkthroughs, discussion forums, instructor support,
-and much more for only $20 by using the [discount link](https://www.udemy.com/python-for-data-structures-algorithms-and-interviews/?couponCode=github_discount)!
-
-
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Bridge Crossing-checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Bridge Crossing-checkpoint.ipynb
deleted file mode 100644
index 405b8032..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Bridge Crossing-checkpoint.ipynb
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Bridge Crossing"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Problem Statement\n",
- "\n",
- "A group of four travelers comes to a bridge at night. The bridge can hold the weight of at most only two of the travelers at a time, and it can- not be crossed without using a flashlight. \n",
- "\n",
- "The travelers have one flashlight among them. Each traveler walks at a different speed: The first can cross the bridge in 1 minute, the second in 2 minutes, the third in 5 minutes, and the fourth takes 10 minutes to cross the bridge. If two travelers cross together, they walk at the speed of the slower traveler.\n",
- "\n",
- "What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?\n",
- "\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Coins and a Scale -checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Coins and a Scale -checkpoint.ipynb
deleted file mode 100644
index 15461219..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Coins and a Scale -checkpoint.ipynb
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Coins and a Scale \n",
- "## Problem Statement\n",
- "\n",
- "You have eight coins and a two-pan scale. All the coins weigh the same, **except for one** which is heavier than all the others. The coins are otherwise indistinguishable. You may make no assumptions about how much heavier the heavy coin is. What is the minimum number of weighings needed to be certain of identifying the heavy coin?"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Egg Drop -checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Egg Drop -checkpoint.ipynb
deleted file mode 100644
index cbe1be74..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Egg Drop -checkpoint.ipynb
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Egg Drop \n",
- "This is probably the most common brain teaser riddle out of the group, so really try to think algorithmically about this problem before looking at the solution!\n",
- "## Problem Statement\n",
- "\n",
- "A tower has 100 floors. You've been given two eggs. The eggs are strong enough that they can be dropped from a particular floor in the tower without breaking. You've been tasked to find the highest floor an egg can be dropped without breaking, in as few drops as possible. If an egg is dropped from above its target floor it will break. If it is dropped from that floor or below, it will be intact and you can test drop the egg again on another floor.\n",
- "\n",
- "Show algorithmically how you would go about doing this in as few drops as possible. (Your answer should be a number of the fewest drops needed for testing 2 eggs on 100 floors)"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Hallway Lockers-checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Hallway Lockers-checkpoint.ipynb
deleted file mode 100644
index 402bfffd..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Hallway Lockers-checkpoint.ipynb
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Hallway Lockers\n",
- "## Problem Statement\n",
- "\n",
- "You are in a hallway lined with 100 lockers. You start with one pass and open the lockers, so that the *opened* lockers are now with their doors opened out. You begin by closing **every second** locker. Then you go to close **every third** locker and **close it if it is open or open it if it’s closed** — we will refer to this as \"toggling\" the lockers. You continue toggling every nth locker on pass number n. After your hundredth pass of the hallway, in which you toggle only locker number 100, how many lockers are open?\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Jugs of Water -checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Jugs of Water -checkpoint.ipynb
deleted file mode 100644
index 727614de..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Jugs of Water -checkpoint.ipynb
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Jugs of Water \n",
- "## Problem Statement\n",
- "\n",
- "You have a five gallons jug and a three gallons jug, and an unlimited supply of water (but no measuring cups) How would you come up with exactly four gallons of water?"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Light Switches -checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Light Switches -checkpoint.ipynb
deleted file mode 100644
index b3b8995a..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Light Switches -checkpoint.ipynb
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Light Switches\n",
- "## Problem Statement\n",
- "\n",
- "You are in a hallway next to three light switches, all of which are off. Each switch activates a different *incandescent* light bulb in the room at the end of the hall. You cannot see the lights from where the switches are. Your task is to determine which light corresponds to each switch. However, you may go into the room with the lights only once.\n",
- "\n",
- "**Note: This is a bit of \"trick\" question, so don't spend too much time on it. Although it is more on the \"fun\" side of brain teaser type questions.**\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Ropes Burning-checkpoint.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Ropes Burning-checkpoint.ipynb
deleted file mode 100644
index c9f81f96..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Ropes Burning-checkpoint.ipynb
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Ropes Burning \n",
- "## Problem Statement\n",
- "\n",
- "You have two ropes. Each takes exactly 60 minutes to burn.\n",
- "\n",
- "They are made of different material so even though they take the same amount of time to burn, they burn at separate rates. In addition, each rope burns inconsistently.\n",
- "\n",
- "How do you measure out exactly 45 minutes?"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Bridge Crossing.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Bridge Crossing.ipynb
deleted file mode 100644
index 405b8032..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Bridge Crossing.ipynb
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Bridge Crossing"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Problem Statement\n",
- "\n",
- "A group of four travelers comes to a bridge at night. The bridge can hold the weight of at most only two of the travelers at a time, and it can- not be crossed without using a flashlight. \n",
- "\n",
- "The travelers have one flashlight among them. Each traveler walks at a different speed: The first can cross the bridge in 1 minute, the second in 2 minutes, the third in 5 minutes, and the fourth takes 10 minutes to cross the bridge. If two travelers cross together, they walk at the speed of the slower traveler.\n",
- "\n",
- "What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?\n",
- "\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Coins and a Scale .ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Coins and a Scale .ipynb
deleted file mode 100644
index 15461219..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Coins and a Scale .ipynb
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Coins and a Scale \n",
- "## Problem Statement\n",
- "\n",
- "You have eight coins and a two-pan scale. All the coins weigh the same, **except for one** which is heavier than all the others. The coins are otherwise indistinguishable. You may make no assumptions about how much heavier the heavy coin is. What is the minimum number of weighings needed to be certain of identifying the heavy coin?"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Egg Drop .ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Egg Drop .ipynb
deleted file mode 100644
index cbe1be74..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Egg Drop .ipynb
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Egg Drop \n",
- "This is probably the most common brain teaser riddle out of the group, so really try to think algorithmically about this problem before looking at the solution!\n",
- "## Problem Statement\n",
- "\n",
- "A tower has 100 floors. You've been given two eggs. The eggs are strong enough that they can be dropped from a particular floor in the tower without breaking. You've been tasked to find the highest floor an egg can be dropped without breaking, in as few drops as possible. If an egg is dropped from above its target floor it will break. If it is dropped from that floor or below, it will be intact and you can test drop the egg again on another floor.\n",
- "\n",
- "Show algorithmically how you would go about doing this in as few drops as possible. (Your answer should be a number of the fewest drops needed for testing 2 eggs on 100 floors)"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Hallway Lockers.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Hallway Lockers.ipynb
deleted file mode 100644
index 402bfffd..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Hallway Lockers.ipynb
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Hallway Lockers\n",
- "## Problem Statement\n",
- "\n",
- "You are in a hallway lined with 100 lockers. You start with one pass and open the lockers, so that the *opened* lockers are now with their doors opened out. You begin by closing **every second** locker. Then you go to close **every third** locker and **close it if it is open or open it if it’s closed** — we will refer to this as \"toggling\" the lockers. You continue toggling every nth locker on pass number n. After your hundredth pass of the hallway, in which you toggle only locker number 100, how many lockers are open?\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Jugs of Water .ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Jugs of Water .ipynb
deleted file mode 100644
index 727614de..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Jugs of Water .ipynb
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Jugs of Water \n",
- "## Problem Statement\n",
- "\n",
- "You have a five gallons jug and a three gallons jug, and an unlimited supply of water (but no measuring cups) How would you come up with exactly four gallons of water?"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Light Switches .ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Light Switches .ipynb
deleted file mode 100644
index b3b8995a..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Light Switches .ipynb
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Light Switches\n",
- "## Problem Statement\n",
- "\n",
- "You are in a hallway next to three light switches, all of which are off. Each switch activates a different *incandescent* light bulb in the room at the end of the hall. You cannot see the lights from where the switches are. Your task is to determine which light corresponds to each switch. However, you may go into the room with the lights only once.\n",
- "\n",
- "**Note: This is a bit of \"trick\" question, so don't spend too much time on it. Although it is more on the \"fun\" side of brain teaser type questions.**\n"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Ropes Burning.ipynb b/Riddles/Riddle Interview Problems/Riddle Interview Problems/Ropes Burning.ipynb
deleted file mode 100644
index c9f81f96..00000000
--- a/Riddles/Riddle Interview Problems/Riddle Interview Problems/Ropes Burning.ipynb
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Ropes Burning \n",
- "## Problem Statement\n",
- "\n",
- "You have two ropes. Each takes exactly 60 minutes to burn.\n",
- "\n",
- "They are made of different material so even though they take the same amount of time to burn, they burn at separate rates. In addition, each rope burns inconsistently.\n",
- "\n",
- "How do you measure out exactly 45 minutes?"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.11"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Balanced Parentheses Check -checkpoint.ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Balanced Parentheses Check -checkpoint.ipynb
deleted file mode 100644
index 274f3ace..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Balanced Parentheses Check -checkpoint.ipynb
+++ /dev/null
@@ -1,171 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Balanced Parentheses Check \n",
- "\n",
- "## Problem Statement\n",
- "\n",
- "Given a string of opening and closing parentheses, check whether it’s balanced. We have 3 types of parentheses: round brackets: (), square brackets: [], and curly brackets: {}. Assume that the string doesn’t contain any other character than these, no spaces words or numbers. As a reminder, balanced parentheses require every opening parenthesis to be closed in the reverse order opened. For example ‘([])’ is balanced but ‘([)]’ is not. \n",
- "\n",
- "\n",
- "You can assume the input string has no spaces.\n",
- "\n",
- "## Solution\n",
- "\n",
- "Fill out your solution below:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def balance_check(s):\n",
- " \n",
- " pass"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 13,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "True"
- ]
- },
- "execution_count": 13,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "balance_check('[]')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "True"
- ]
- },
- "execution_count": 16,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "balance_check('[](){([[[]]])}')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "False"
- ]
- },
- "execution_count": 17,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "balance_check('()(){]}')"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Test Your Solution"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 18,
- "metadata": {
- "collapsed": false
- },
- "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 TestBalanceCheck(object):\n",
- " \n",
- " def test(self,sol):\n",
- " assert_equal(sol('[](){([[[]]])}('),False)\n",
- " assert_equal(sol('[{{{(())}}}]((()))'),True)\n",
- " assert_equal(sol('[[[]])]'),False)\n",
- " print 'ALL TEST CASES PASSED'\n",
- " \n",
- "# Run Tests\n",
- "\n",
- "t = TestBalanceCheck()\n",
- "t.test(balance_check)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Deque -checkpoint.ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Deque -checkpoint.ipynb
deleted file mode 100644
index d5c255f7..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Deque -checkpoint.ipynb
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Deque \n",
- "\n",
- "Finally, implement a Deque class! It should be able to do the following:\n",
- "\n",
- "* Check if its empty\n",
- "* Add to both front and rear\n",
- "* Remove from Front and Rear\n",
- "* Check the Size"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Deque(object):\n",
- " pass"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue -Using Two Stacks -checkpoint.ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue -Using Two Stacks -checkpoint.ipynb
deleted file mode 100644
index 907956a6..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue -Using Two Stacks -checkpoint.ipynb
+++ /dev/null
@@ -1,131 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Queue - Using Two Stacks\n",
- "\n",
- "Given the Stack class below, implement a Queue class using **two** stacks! Note, this is a \"classic\" interview problem. Use a Python list data structure as your Stack."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 30,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "# Uses lists instead of your own Stack class.\n",
- "stack1 = []\n",
- "stack2 = []"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Solution\n",
- "\n",
- "Fill out your solution below:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 31,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Queue2Stacks(object):\n",
- " \n",
- " def __init__(self):\n",
- " \n",
- " # Two Stacks\n",
- " self.stack1 = []\n",
- " self.stack2 = []\n",
- " \n",
- " def enqueue(self,element):\n",
- " \n",
- " # FILL OUT CODE HERE\n",
- " pass\n",
- " \n",
- " def dequeue(self):\n",
- " \n",
- " # FILL OUT CODE HERE\n",
- " pass "
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Test Your Solution\n",
- "\n",
- "You should be able to tell with your current knowledge of Stacks and Queues if this is working as it should. For example, the following should print as such:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 34,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "0\n",
- "1\n",
- "2\n",
- "3\n",
- "4\n"
- ]
- }
- ],
- "source": [
- "\"\"\"\n",
- "RUN THIS CELL TO CHECK THAT YOUR SOLUTION OUTPUT MAKES SENSE AND BEHAVES AS A QUEUE\n",
- "\"\"\"\n",
- "q = Queue2Stacks()\n",
- "\n",
- "for i in xrange(5):\n",
- " q.enqueue(i)\n",
- " \n",
- "for i in xrange(5):\n",
- " print q.dequeue()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue-checkpoint.ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue-checkpoint.ipynb
deleted file mode 100644
index a5ac0019..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue-checkpoint.ipynb
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Queue\n",
- "\n",
- "It's very common to be asked to implement a Queue class! The class should be able to do the following:\n",
- "\n",
- "* Check if Queue is Empty\n",
- "* Enqueue\n",
- "* Dequeue\n",
- "* Return the size of the Queue"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Queue(object):\n",
- " pass"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Stack -checkpoint.ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Stack -checkpoint.ipynb
deleted file mode 100644
index 6dea3952..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Stack -checkpoint.ipynb
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Stack \n",
- "\n",
- "A very common interview question is to begin by just implementing a Stack! Try your best to implement your own stack!\n",
- "\n",
- "It should have the methods:\n",
- "\n",
- "* Check if its empty\n",
- "* Push a new item\n",
- "* Pop an item\n",
- "* Peek at the top item\n",
- "* Return the size"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Stack(object):\n",
- " \n",
- " \n",
- " # Fill out the Stack Methods here\n",
- " pass"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Balanced Parentheses Check .ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Balanced Parentheses Check .ipynb
deleted file mode 100644
index 274f3ace..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Balanced Parentheses Check .ipynb
+++ /dev/null
@@ -1,171 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Balanced Parentheses Check \n",
- "\n",
- "## Problem Statement\n",
- "\n",
- "Given a string of opening and closing parentheses, check whether it’s balanced. We have 3 types of parentheses: round brackets: (), square brackets: [], and curly brackets: {}. Assume that the string doesn’t contain any other character than these, no spaces words or numbers. As a reminder, balanced parentheses require every opening parenthesis to be closed in the reverse order opened. For example ‘([])’ is balanced but ‘([)]’ is not. \n",
- "\n",
- "\n",
- "You can assume the input string has no spaces.\n",
- "\n",
- "## Solution\n",
- "\n",
- "Fill out your solution below:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "def balance_check(s):\n",
- " \n",
- " pass"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 13,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "True"
- ]
- },
- "execution_count": 13,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "balance_check('[]')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "True"
- ]
- },
- "execution_count": 16,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "balance_check('[](){([[[]]])}')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "False"
- ]
- },
- "execution_count": 17,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "balance_check('()(){]}')"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Test Your Solution"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 18,
- "metadata": {
- "collapsed": false
- },
- "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 TestBalanceCheck(object):\n",
- " \n",
- " def test(self,sol):\n",
- " assert_equal(sol('[](){([[[]]])}('),False)\n",
- " assert_equal(sol('[{{{(())}}}]((()))'),True)\n",
- " assert_equal(sol('[[[]])]'),False)\n",
- " print 'ALL TEST CASES PASSED'\n",
- " \n",
- "# Run Tests\n",
- "\n",
- "t = TestBalanceCheck()\n",
- "t.test(balance_check)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Deque .ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Deque .ipynb
deleted file mode 100644
index d5c255f7..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Deque .ipynb
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Deque \n",
- "\n",
- "Finally, implement a Deque class! It should be able to do the following:\n",
- "\n",
- "* Check if its empty\n",
- "* Add to both front and rear\n",
- "* Remove from Front and Rear\n",
- "* Check the Size"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Deque(object):\n",
- " pass"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue -Using Two Stacks .ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue -Using Two Stacks .ipynb
deleted file mode 100644
index 907956a6..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue -Using Two Stacks .ipynb
+++ /dev/null
@@ -1,131 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Queue - Using Two Stacks\n",
- "\n",
- "Given the Stack class below, implement a Queue class using **two** stacks! Note, this is a \"classic\" interview problem. Use a Python list data structure as your Stack."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 30,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "# Uses lists instead of your own Stack class.\n",
- "stack1 = []\n",
- "stack2 = []"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Solution\n",
- "\n",
- "Fill out your solution below:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 31,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Queue2Stacks(object):\n",
- " \n",
- " def __init__(self):\n",
- " \n",
- " # Two Stacks\n",
- " self.stack1 = []\n",
- " self.stack2 = []\n",
- " \n",
- " def enqueue(self,element):\n",
- " \n",
- " # FILL OUT CODE HERE\n",
- " pass\n",
- " \n",
- " def dequeue(self):\n",
- " \n",
- " # FILL OUT CODE HERE\n",
- " pass "
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Test Your Solution\n",
- "\n",
- "You should be able to tell with your current knowledge of Stacks and Queues if this is working as it should. For example, the following should print as such:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 34,
- "metadata": {
- "collapsed": false
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "0\n",
- "1\n",
- "2\n",
- "3\n",
- "4\n"
- ]
- }
- ],
- "source": [
- "\"\"\"\n",
- "RUN THIS CELL TO CHECK THAT YOUR SOLUTION OUTPUT MAKES SENSE AND BEHAVES AS A QUEUE\n",
- "\"\"\"\n",
- "q = Queue2Stacks()\n",
- "\n",
- "for i in xrange(5):\n",
- " q.enqueue(i)\n",
- " \n",
- "for i in xrange(5):\n",
- " print q.dequeue()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Good Job!"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue.ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue.ipynb
deleted file mode 100644
index a5ac0019..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue.ipynb
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Queue\n",
- "\n",
- "It's very common to be asked to implement a Queue class! The class should be able to do the following:\n",
- "\n",
- "* Check if Queue is Empty\n",
- "* Enqueue\n",
- "* Dequeue\n",
- "* Return the size of the Queue"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Queue(object):\n",
- " pass"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Stack .ipynb b/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Stack .ipynb
deleted file mode 100644
index 6dea3952..00000000
--- a/Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Stack .ipynb
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# Implement a Stack \n",
- "\n",
- "A very common interview question is to begin by just implementing a Stack! Try your best to implement your own stack!\n",
- "\n",
- "It should have the methods:\n",
- "\n",
- "* Check if its empty\n",
- "* Push a new item\n",
- "* Pop an item\n",
- "* Peek at the top item\n",
- "* Return the size"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "class Stack(object):\n",
- " \n",
- " \n",
- " # Fill out the Stack Methods here\n",
- " pass"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 2",
- "language": "python",
- "name": "python2"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 2
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}