├── .ipynb_checkpoints ├── Big O Notation-checkpoint.ipynb ├── Practice-checkpoint.ipynb └── Reflect Notes-checkpoint.ipynb ├── .project ├── .pydevproject ├── 01-Algorithm Analysis and Big O ├── .ipynb_checkpoints │ ├── Algorithm Analysis and Big O Quiz-checkpoint.ipynb │ ├── Big O Examples -checkpoint.ipynb │ ├── Big O Notation-checkpoint.ipynb │ ├── Big O for Python Data Structures-checkpoint.ipynb │ └── Introduction to Algorithm Analysis and Big O -checkpoint.ipynb ├── 01-Introduction to Algorithm Analysis and Big O .ipynb ├── 02-Big O Notation.ipynb ├── 03-Big O Examples .ipynb ├── 04-Big O for Python Data Structures.ipynb └── 05-Algorithm Analysis and Big O Quiz.ipynb ├── 02-Array Sequences ├── .ipynb_checkpoints │ ├── 01-Introduction to Array Based Sequences-checkpoint.ipynb │ ├── 02-Low Level Arrays-checkpoint.ipynb │ ├── 04-Dynamic Array Exercise-checkpoint.ipynb │ ├── 05-Amortization-checkpoint.ipynb │ ├── 06-Array Mini-Project-checkpoint.ipynb │ ├── Amortization-checkpoint.ipynb │ ├── Array Mini-Project-checkpoint.ipynb │ ├── Dynamic Array Exercise-checkpoint.ipynb │ ├── Dynamic Arrays-checkpoint.ipynb │ ├── Introduction to Array Based Sequences-checkpoint.ipynb │ └── Low Level Arrays-checkpoint.ipynb ├── 01-Introduction to Array Based Sequences.ipynb ├── 02-Low Level Arrays.ipynb ├── 03-Dynamic Array.ipynb ├── 04-Dynamic Array Exercise.ipynb ├── 05-Amortization.ipynb ├── 06-Array Mini-Project.ipynb └── Array Sequences Interview Questions │ ├── 01-Anagram-Check │ ├── 01-Anagram Check - SOLUTION.ipynb │ └── 01-Anagram Check .ipynb │ ├── 02-Array-Pair-Sum │ ├── 02-Array Pair Sum - SOLUTION.ipynb │ └── 02-Array Pair Sum .ipynb │ ├── 03-Finding-the-Missing-Element │ ├── 03-Find the Missing Element - SOLUTION.ipynb │ └── 03-Find the Missing Element .ipynb │ ├── 04-Largest-Continuous-Sum │ ├── 04-Largest Continuous Sum - SOLUTION.ipynb │ └── 04-Largest Continuous Sum .ipynb │ ├── 05-Sentence-Reversal │ ├── 05-Sentence Reversal - SOLUTION.ipynb │ └── 05-Sentence Reversal.ipynb │ ├── 06-String-Compression │ ├── 06-String Compression -SOLUTION.ipynb │ └── 06-String Compression .ipynb │ └── 07-Unique-Characters-in-String │ ├── 07-Unique Characters in String - SOLUTION.ipynb │ └── 07-Unique Characters in String.ipynb ├── 03-Stacks, Queues and Deques ├── .ipynb_checkpoints │ ├── 01-Stacks, Queues, and Deques Overview-checkpoint.ipynb │ ├── 02-Stacks Overview-checkpoint.ipynb │ ├── 03-Implementation of Stack-checkpoint.ipynb │ ├── 04-Queues Overview-checkpoint.ipynb │ ├── 05-Implementation of Queue-checkpoint.ipynb │ ├── 06-Deques Overview-checkpoint.ipynb │ └── 07-Implementation of Deque-checkpoint.ipynb ├── 01-Stacks, Queues, and Deques Overview.ipynb ├── 02-Stacks Overview.ipynb ├── 03-Implementation of Stack.ipynb ├── 04-Queues Overview.ipynb ├── 05-Implementation of Queue.ipynb ├── 06-Deques Overview.ipynb ├── 07-Implementation of Deque.ipynb └── Stacks, Queues, and Deques Interview Problems │ ├── 01-Implement-a-Stack │ ├── 01-Implement a Stack - SOLUTION.ipynb │ └── 01-Implement a Stack .ipynb │ ├── 02-Implement-a-Queue │ ├── 02-Implement a Queue - SOLUTION.ipynb │ └── 02-Implement a Queue.ipynb │ ├── 03-Implement-a-Deque │ ├── 03-Implement a Deque - SOLUTION.ipynb │ └── 03-Implement a Deque .ipynb │ ├── 04-Balanced-Parantheses-Check │ ├── 04-Balanced Parentheses Check - SOLUTION.ipynb │ └── 04-Balanced Parentheses Check .ipynb │ └── 05-Implement-a-Queue-Using-Two-Stacks │ ├── 05-Implement a Queue -Using Two Stacks - SOLUTION.ipynb │ └── 05-Implement a Queue -Using Two Stacks .ipynb ├── 04-Linked Lists ├── .ipynb_checkpoints │ ├── 01-Linked List Overview-checkpoint.ipynb │ ├── 02-Singly Linked Lists-checkpoint.ipynb │ ├── 03-Singly Linked List Implementation-checkpoint.ipynb │ ├── 04-Doubly Linked Lists-checkpoint.ipynb │ └── 05-Doubly Linked List Implementation-checkpoint.ipynb ├── 01-Linked List Overview.ipynb ├── 02-Singly Linked Lists.ipynb ├── 03-Singly Linked List Implementation.ipynb ├── 04-Doubly Linked Lists.ipynb ├── 05-Doubly Linked List Implementation.ipynb └── Linked Lists Interview Problems │ ├── 01-Singly-Linked-List-Cycle-Check │ ├── 01-Singly Linked List Cycle Check - SOLUTION.ipynb │ └── 01-Singly Linked List Cycle Check.ipynb │ ├── 02-Linked-List-Reversal │ ├── 02-Linked List Reversal - SOLUTION.ipynb │ └── 02-Linked List Reversal .ipynb │ ├── 03-Linked-List-Nth-to-Last-Node │ ├── 03-Linked List Nth to Last Node - SOLUTION.ipynb │ └── 03-Linked List Nth to Last Node .ipynb │ ├── 04-Implement-a-Doubly-Linked-List │ ├── 04-Implement a Doubly Linked List.ipynb │ └── 04-Implement a Linked List -SOLUTION.ipynb │ └── 05-Implement-a-Singly-Linked-List │ └── 05-Implement a Singly Linked List.ipynb ├── 05-Recursion ├── .ipynb_checkpoints │ ├── 01-Introduction to Recursion-checkpoint.ipynb │ ├── 02-Recursion Homework Example Problems-checkpoint.ipynb │ ├── 03-Recursion Homework Example Problems - SOLUTIONS-checkpoint.ipynb │ ├── 04-Recursion Homework Example Problems - PRACTICE-checkpoint.ipynb │ └── 05-Memoization-checkpoint.ipynb ├── 01-Introduction to Recursion.ipynb ├── 02-Recursion Homework Example Problems.ipynb ├── 03-Recursion Homework Example Problems - SOLUTIONS.ipynb ├── 04-Recursion Homework Example Problems - PRACTICE.ipynb ├── 05-Memoization.ipynb └── Recursion Interview Problems │ ├── 01-Reverse-String │ ├── 01-Reverse String - SOLUTION.ipynb │ └── 01-Reverse String .ipynb │ ├── 02-String-Permutation │ ├── 02-String Permutation- SOLUTION.ipynb │ └── 02-String Permutation.ipynb │ ├── 03-Fibonacci-Sequence │ ├── 03-Fibonacci Sequence - SOLUTION.ipynb │ └── 03-Fibonacci Sequence.ipynb │ └── 04-Coin-Change │ ├── 04-Coin Change - SOLUTION.ipynb │ └── 04-Coin Change.ipynb ├── 06-Trees ├── .ipynb_checkpoints │ ├── 01-Tree Representation Implementation (Lists)-checkpoint.ipynb │ ├── 02-Tree Representation Implementation (Nodes and References)-checkpoint.ipynb │ ├── 03-Binary Heap Implementation-checkpoint.ipynb │ └── 04-Binary Search Trees-checkpoint.ipynb ├── 01-Tree Representation Implementation (Lists).ipynb ├── 02-Tree Representation Implementation (Nodes and References).ipynb ├── 03-Binary Heap Implementation.ipynb ├── 04-Binary Search Trees.ipynb └── Trees Interview Problems │ ├── .ipynb_checkpoints │ ├── 01-Binary Search Tree Check-checkpoint.ipynb │ ├── 02-Tree Level Order Print-checkpoint.ipynb │ └── 03-Trim a Binary Search Tree -checkpoint.ipynb │ ├── 01-Binary-Search-Tree-Check │ ├── 01-Binary Search Tree Check - SOLUTION.ipynb │ └── 01-Binary Search Tree Check.ipynb │ ├── 02-Tree-Level-Order-Print │ ├── .ipynb_checkpoints │ │ ├── 02-Tree Level Order Print - SOLUTION-checkpoint.ipynb │ │ └── 02-Tree Level Order Print-checkpoint.ipynb │ ├── 02-Tree Level Order Print - SOLUTION.ipynb │ ├── 02-Tree Level Order Print.ipynb │ └── tree_print.png │ └── 03-Trim-a-Binary-Search-Tree │ ├── .ipynb_checkpoints │ ├── 03-Trim a Binary Search Tree -checkpoint.ipynb │ └── 03Trim a Binary Search Tree - SOLUTION-checkpoint.ipynb │ ├── 03-Trim a Binary Search Tree .ipynb │ ├── 03Trim a Binary Search Tree - SOLUTION.ipynb │ ├── bst1.png │ └── bst_trim.png ├── 07-Searching and Sorting ├── .ipynb_checkpoints │ ├── 01-Sequential Search-checkpoint.ipynb │ ├── 02-Implementation of Binary Search-checkpoint.ipynb │ ├── 03-Implementation of a Hash Table-checkpoint.ipynb │ ├── 04-Implementation of Bubble Sort-checkpoint.ipynb │ ├── 05-Implementation of Selection Sort-checkpoint.ipynb │ ├── 06-Implementation of Insertion Sort-checkpoint.ipynb │ ├── 07-Implementation of Shell Sort-checkpoint.ipynb │ ├── 08-Implementation of Merge Sort-checkpoint.ipynb │ └── 09-Implementation of Quick Sort-checkpoint.ipynb ├── 01-Sequential Search.ipynb ├── 02-Implementation of Binary Search.ipynb ├── 03-Implementation of a Hash Table.ipynb ├── 04-Implementation of Bubble Sort.ipynb ├── 05-Implementation of Selection Sort.ipynb ├── 06-Implementation of Insertion Sort.ipynb ├── 07-Implementation of Shell Sort.ipynb ├── 08-Implementation of Merge Sort.ipynb └── 09-Implementation of Quick Sort.ipynb ├── 08-Graphs ├── .ipynb_checkpoints │ ├── 01-Implementation of Graph Overview-checkpoint.ipynb │ ├── 02-Implementation of Adjacency List-checkpoint.ipynb │ ├── 03-Word Ladder Example Problem-checkpoint.ipynb │ ├── 04-Knight's Tour Example Problem-checkpoint.ipynb │ ├── 05-Implementation of Depth First Search-checkpoint.ipynb │ └── 06-Implementation of Breadth First Search-checkpoint.ipynb ├── 01-Implementation of Graph Overview.ipynb ├── 02-Implementation of Adjacency List.ipynb ├── 03-Word Ladder Example Problem.ipynb ├── 04-Knight's Tour Example Problem.ipynb ├── 05-Implementation of Depth First Search.ipynb ├── 06-Implementation of Breadth First Search.ipynb ├── Graph Interview Questions │ ├── .ipynb_checkpoints │ │ ├── 01-Implement a Graph-checkpoint.ipynb │ │ ├── 02-Implement Depth First Search Algorithm-checkpoint.ipynb │ │ └── 03-Implement Breadth First Search Algorithm-checkpoint.ipynb │ ├── 01-Implement a Graph.ipynb │ ├── 02-Implement Depth First Search Algorithm.ipynb │ └── 03-Implement Breadth First Search Algorithm.ipynb └── words.txt ├── 09-Riddles ├── .ipynb_checkpoints │ └── 01-How to Approach Riddles-checkpoint.ipynb ├── 01-How to Approach Riddles.ipynb └── Riddle Interview Problems │ ├── 01-Bridge-Crossing │ ├── 01-Bridge Crossing - SOLUTION.ipynb │ └── 01-Bridge Crossing.ipynb │ ├── 02-Coins-and-a-Scale │ ├── 02-Coins and a Scale - SOLUTION.ipynb │ └── 02-Coins and a Scale .ipynb │ ├── 03-Egg-Drop │ ├── 03-Egg Drop - SOLUTION.ipynb │ └── 03-Egg Drop .ipynb │ ├── 04-Hallway-Lockers │ ├── 04-Hallway Lockers -SOLUTION.ipynb │ └── 04-Hallway Lockers.ipynb │ ├── 05-Jugs-of-Water │ ├── 05-Jugs of Water - SOLUTION.ipynb │ └── 05-Jugs of Water .ipynb │ ├── 06-Light-Switches │ ├── 06-Light Switches - SOLUTION.ipynb │ └── 06-Light Switches .ipynb │ └── 07-Ropes-Burning │ ├── 07-Ropes Burning - SOLUTION.ipynb │ └── 07-Ropes Burning.ipynb ├── 10-Mock Interviews ├── 01-Large E-Commerce Company │ ├── 01-On-Site-Question-1 │ │ ├── 01-On-Site Question 1 - SOLUTION.ipynb │ │ └── 01-On-Site Question 1.ipynb │ ├── 02-On-Site-Question-2 │ │ ├── 02-On-Site Question 2 - SOLUTION.ipynb │ │ └── 02-On-Site Question 2 .ipynb │ ├── 03-On-Site-Question-3 │ │ ├── 03-On-Site Question 3 - SOLUTION.ipynb │ │ └── 03-On-Site Question 3.ipynb │ └── 04-Phone-Screen │ │ ├── 04-Phone Screen - SOLUTION.ipynb │ │ └── 04-Phone Screen .ipynb ├── 02-Large Search Engine Company │ ├── 01-On-Site-Question-1 │ │ ├── 01-On-Site Question 1 - SOLUTION.ipynb │ │ └── 01-On-Site Question 1 .ipynb │ ├── 02-On-Site-Question-2 │ │ ├── 02-On-Site Question 2 - SOLUTION.ipynb │ │ └── 02-On-Site Question 2 .ipynb │ ├── 03-On-Site-Question-3 │ │ ├── 03-On-Site Question 3 -SOLUTION.ipynb │ │ └── 03-On-Site Question 3 .ipynb │ ├── 04-On-Site-Question-4 │ │ ├── 04-On-Site Question 4 - SOLUTION.ipynb │ │ └── 04-On-Site Question 4 .ipynb │ └── 05-Phone-Screen │ │ ├── 05-Phone Screen-Solutions.ipynb │ │ └── 05-Phone Screen.ipynb ├── 03-Ride Share Start-Up Company │ ├── 01-On-Site-Quesion-1 │ │ ├── On-Site Question 1 - SOLUTION.ipynb │ │ └── On-Site Question 1 .ipynb │ ├── 02-On-Site-Quesion-2 │ │ ├── On-Site Question 2 - SOLUTION.ipynb │ │ └── On-Site Question 2 .ipynb │ ├── 03-On-Site-Quesion-3 │ │ ├── On-Site Question 3 - SOLUTION.ipynb │ │ └── On-Site Question 3 .ipynb │ └── 04-Phone-Screen │ │ ├── Phone Screen - SOLUTION.ipynb │ │ └── Phone Screen .ipynb └── 04-Social Network Company │ ├── 01-On-Site-Question-1 │ ├── On-Site Question 1 - SOLUTION.ipynb │ └── On-Site Question 1.ipynb │ ├── 02-On-Site-Question-2 │ ├── On-Site Question 2 - SOLUTION.ipynb │ └── On-Site Question 2.ipynb │ ├── 03-On-Site-Question-3 │ ├── On-Site Question 3 - SOLUTION.ipynb │ └── On-Site Question 3.ipynb │ └── 04-Phone-Screen │ ├── Phone Screen - SOLUTION.ipynb │ └── Phone Screen .ipynb ├── Linked Lists └── Linked Lists Interview Problems │ └── Linked List Interview Problems │ ├── .ipynb_checkpoints │ ├── Implement a Doubly Linked List-checkpoint.ipynb │ ├── Implement a Singly Linked List-checkpoint.ipynb │ ├── Linked List Nth to Last Node -checkpoint.ipynb │ ├── Linked List Reversal -checkpoint.ipynb │ └── Singly Linked List Cycle Check-checkpoint.ipynb │ ├── Implement a Doubly Linked List.ipynb │ ├── Implement a Singly Linked List.ipynb │ ├── Linked List Nth to Last Node .ipynb │ ├── Linked List Reversal .ipynb │ └── Singly Linked List Cycle Check.ipynb ├── Mock Interviews ├── Large Search Engine Company │ ├── Search Engine Company - Interview Problems - SOLUTIONS │ │ ├── .ipynb_checkpoints │ │ │ ├── On-Site Question 1 - SOLUTION-checkpoint.ipynb │ │ │ ├── On-Site Question 2 - SOLUTION-checkpoint.ipynb │ │ │ ├── On-Site Question 3 -SOLUTION-checkpoint.ipynb │ │ │ ├── On-Site Question 4 - SOLUTION-checkpoint.ipynb │ │ │ └── Phone Screen-checkpoint.ipynb │ │ ├── On-Site Question 1 - SOLUTION.ipynb │ │ ├── On-Site Question 2 - SOLUTION.ipynb │ │ ├── On-Site Question 3 -SOLUTION.ipynb │ │ ├── On-Site Question 4 - SOLUTION.ipynb │ │ └── Phone Screen.ipynb │ └── Search Engine Company - Interview Problems │ │ ├── .ipynb_checkpoints │ │ ├── On-Site Question 1 -checkpoint.ipynb │ │ ├── On-Site Question 2 -checkpoint.ipynb │ │ ├── On-Site Question 3 -checkpoint.ipynb │ │ ├── On-Site Question 4 -checkpoint.ipynb │ │ └── Phone Screen-checkpoint.ipynb │ │ ├── On-Site Question 1 .ipynb │ │ ├── On-Site Question 2 .ipynb │ │ ├── On-Site Question 3 .ipynb │ │ ├── On-Site Question 4 .ipynb │ │ └── Phone Screen.ipynb ├── Ride Share Start-Up Company │ └── Ride Share Company - Interview Questions │ │ ├── .ipynb_checkpoints │ │ ├── On-Site Question 1 -checkpoint.ipynb │ │ ├── On-Site Question 2 -checkpoint.ipynb │ │ ├── On-Site Question 3 -checkpoint.ipynb │ │ └── Phone Screen -checkpoint.ipynb │ │ ├── On-Site Question 1 .ipynb │ │ ├── On-Site Question 2 .ipynb │ │ ├── On-Site Question 3 .ipynb │ │ └── Phone Screen .ipynb └── Social Network Company │ └── Social Network Company - Interview Questions │ ├── .ipynb_checkpoints │ ├── On-Site Question 1-checkpoint.ipynb │ ├── On-Site Question 2-checkpoint.ipynb │ ├── On-Site Question 3-checkpoint.ipynb │ └── Phone Screen -checkpoint.ipynb │ ├── On-Site Question 1.ipynb │ ├── On-Site Question 2.ipynb │ ├── On-Site Question 3.ipynb │ └── Phone Screen .ipynb ├── Practice.ipynb ├── README.md ├── Reflect Notes.ipynb ├── Riddles └── Riddle Interview Problems │ └── Riddle Interview Problems │ ├── .ipynb_checkpoints │ ├── Bridge Crossing-checkpoint.ipynb │ ├── Coins and a Scale -checkpoint.ipynb │ ├── Egg Drop -checkpoint.ipynb │ ├── Hallway Lockers-checkpoint.ipynb │ ├── Jugs of Water -checkpoint.ipynb │ ├── Light Switches -checkpoint.ipynb │ └── Ropes Burning-checkpoint.ipynb │ ├── Bridge Crossing.ipynb │ ├── Coins and a Scale .ipynb │ ├── Egg Drop .ipynb │ ├── Hallway Lockers.ipynb │ ├── Jugs of Water .ipynb │ ├── Light Switches .ipynb │ └── Ropes Burning.ipynb └── Stacks, Queues and Deques └── Stacks, Queues, and Deques Interview Problems └── Stacks, Queues, Deques Interview Questions ├── .ipynb_checkpoints ├── Balanced Parentheses Check -checkpoint.ipynb ├── Implement a Deque -checkpoint.ipynb ├── Implement a Queue -Using Two Stacks -checkpoint.ipynb ├── Implement a Queue-checkpoint.ipynb └── Implement a Stack -checkpoint.ipynb ├── Balanced Parentheses Check .ipynb ├── Implement a Deque .ipynb ├── Implement a Queue -Using Two Stacks .ipynb ├── Implement a Queue.ipynb └── Implement a Stack .ipynb /.ipynb_checkpoints/Big O Notation-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 2", 16 | "language": "python", 17 | "name": "python2" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 2 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython2", 29 | "version": "2.7.10" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 0 34 | } 35 | -------------------------------------------------------------------------------- /.ipynb_checkpoints/Reflect Notes-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Array\n", 8 | "- Python use reference when slide or extend an array. (Because python uses immutable value for integers and strings)\n", 9 | "## Dynamic Array Implementation\n", 10 | "- The array has an initial size and will expand twice when extending.\n" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "\" \".join()\n", 20 | "reversed()\n", 21 | "s.split()\n", 22 | "len(set(s))" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 3", 29 | "language": "python", 30 | "name": "python3" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 3 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython3", 42 | "version": "3.6.2" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 2 47 | } 48 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Python-for-Algorithm-and-Interviews 4 | 5 | 6 | 7 | 8 | 9 | org.python.pydev.PyDevBuilder 10 | 11 | 12 | 13 | 14 | 15 | org.python.pydev.pythonNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.pydevproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | Default 4 | python interpreter 5 | 6 | -------------------------------------------------------------------------------- /01-Algorithm Analysis and Big O/.ipynb_checkpoints/Algorithm Analysis and Big O Quiz-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Quiz is offered only in the course!" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.10" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 1 32 | } 33 | -------------------------------------------------------------------------------- /01-Algorithm Analysis and Big O/05-Algorithm Analysis and Big O Quiz.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Quiz is offered only in the course!" 8 | ] 9 | } 10 | ], 11 | "metadata": { 12 | "kernelspec": { 13 | "display_name": "Python 3", 14 | "language": "python", 15 | "name": "python3" 16 | }, 17 | "language_info": { 18 | "codemirror_mode": { 19 | "name": "ipython", 20 | "version": 3 21 | }, 22 | "file_extension": ".py", 23 | "mimetype": "text/x-python", 24 | "name": "python", 25 | "nbconvert_exporter": "python", 26 | "pygments_lexer": "ipython3", 27 | "version": "3.8.10" 28 | } 29 | }, 30 | "nbformat": 4, 31 | "nbformat_minor": 1 32 | } 33 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/01-Introduction to Array Based Sequences-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Introduction to Array Based Sequences\n", 8 | "\n", 9 | "In this lecture, we will get a brief overview of the \"sequence\" type object classes available in Python. These are mainly the **list**,**tuple**, and **string** objects. The main commonaility between these object types is the ability to index to access individual elements in the sequence. For example:" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "data": { 19 | "text/plain": [ 20 | "1" 21 | ] 22 | }, 23 | "execution_count": 1, 24 | "metadata": {}, 25 | "output_type": "execute_result" 26 | } 27 | ], 28 | "source": [ 29 | "l = [1,2,3]\n", 30 | "l[0]" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 2, 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/plain": [ 41 | "1" 42 | ] 43 | }, 44 | "execution_count": 2, 45 | "metadata": {}, 46 | "output_type": "execute_result" 47 | } 48 | ], 49 | "source": [ 50 | "t = (1,2,3)\n", 51 | "t[0]" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": 3, 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "data": { 61 | "text/plain": [ 62 | "'1'" 63 | ] 64 | }, 65 | "execution_count": 3, 66 | "metadata": {}, 67 | "output_type": "execute_result" 68 | } 69 | ], 70 | "source": [ 71 | "s = '123'\n", 72 | "s[0]" 73 | ] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "metadata": {}, 78 | "source": [ 79 | "## Please refer to the video lecture for the remaining information.\n", 80 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 81 | "# Thanks!" 82 | ] 83 | } 84 | ], 85 | "metadata": { 86 | "kernelspec": { 87 | "display_name": "Python 3", 88 | "language": "python", 89 | "name": "python3" 90 | }, 91 | "language_info": { 92 | "codemirror_mode": { 93 | "name": "ipython", 94 | "version": 3 95 | }, 96 | "file_extension": ".py", 97 | "mimetype": "text/x-python", 98 | "name": "python", 99 | "nbconvert_exporter": "python", 100 | "pygments_lexer": "ipython3", 101 | "version": "3.8.10" 102 | } 103 | }, 104 | "nbformat": 4, 105 | "nbformat_minor": 1 106 | } 107 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/02-Low Level Arrays-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Low Level Arrays" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": { 13 | "collapsed": true 14 | }, 15 | "source": [ 16 | "## Please refer to the video lecture for the remaining information.\n", 17 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 18 | "# Thanks!" 19 | ] 20 | } 21 | ], 22 | "metadata": { 23 | "kernelspec": { 24 | "display_name": "Python 3", 25 | "language": "python", 26 | "name": "python3" 27 | }, 28 | "language_info": { 29 | "codemirror_mode": { 30 | "name": "ipython", 31 | "version": 3 32 | }, 33 | "file_extension": ".py", 34 | "mimetype": "text/x-python", 35 | "name": "python", 36 | "nbconvert_exporter": "python", 37 | "pygments_lexer": "ipython3", 38 | "version": "3.8.10" 39 | } 40 | }, 41 | "nbformat": 4, 42 | "nbformat_minor": 1 43 | } 44 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/05-Amortization-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Amortization" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": { 13 | "collapsed": true 14 | }, 15 | "source": [ 16 | "___\n", 17 | "## Please refer to the video lecture for the remaining information.\n", 18 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 19 | "# Thanks!" 20 | ] 21 | } 22 | ], 23 | "metadata": { 24 | "kernelspec": { 25 | "display_name": "Python 3", 26 | "language": "python", 27 | "name": "python3" 28 | }, 29 | "language_info": { 30 | "codemirror_mode": { 31 | "name": "ipython", 32 | "version": 3 33 | }, 34 | "file_extension": ".py", 35 | "mimetype": "text/x-python", 36 | "name": "python", 37 | "nbconvert_exporter": "python", 38 | "pygments_lexer": "ipython3", 39 | "version": "3.8.10" 40 | } 41 | }, 42 | "nbformat": 4, 43 | "nbformat_minor": 1 44 | } 45 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/06-Array Mini-Project-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "collapsed": true 7 | }, 8 | "source": [ 9 | "# Array Mini-Project\n", 10 | "\n", 11 | "In this mini project we will create our own scoreboard project to understand arrays better!" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": { 18 | "collapsed": true 19 | }, 20 | "outputs": [], 21 | "source": [] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.8.10" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 1 45 | } 46 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/Amortization-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Amortization" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": { 13 | "collapsed": true 14 | }, 15 | "source": [ 16 | "___\n", 17 | "## Please refer to the video lecture for the remaining information.\n", 18 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 19 | "# Thanks!" 20 | ] 21 | } 22 | ], 23 | "metadata": { 24 | "kernelspec": { 25 | "display_name": "Python 2", 26 | "language": "python", 27 | "name": "python2" 28 | }, 29 | "language_info": { 30 | "codemirror_mode": { 31 | "name": "ipython", 32 | "version": 2 33 | }, 34 | "file_extension": ".py", 35 | "mimetype": "text/x-python", 36 | "name": "python", 37 | "nbconvert_exporter": "python", 38 | "pygments_lexer": "ipython2", 39 | "version": "2.7.10" 40 | } 41 | }, 42 | "nbformat": 4, 43 | "nbformat_minor": 0 44 | } 45 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/Array Mini-Project-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "collapsed": true 7 | }, 8 | "source": [ 9 | "# Array Mini-Project\n", 10 | "\n", 11 | "In this mini project we will create our own scoreboard project to understand arrays better!" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": { 18 | "collapsed": true 19 | }, 20 | "outputs": [], 21 | "source": [] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 2", 27 | "language": "python", 28 | "name": "python2" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 2 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython2", 40 | "version": "2.7.10" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 0 45 | } 46 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/Dynamic Arrays-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Dynamic Arrays\n", 8 | "____\n" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "metadata": { 14 | "collapsed": true 15 | }, 16 | "source": [ 17 | "## Please refer to the video lecture for the remaining information.\n", 18 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 19 | "# Thanks!" 20 | ] 21 | } 22 | ], 23 | "metadata": { 24 | "kernelspec": { 25 | "display_name": "Python 2", 26 | "language": "python", 27 | "name": "python2" 28 | }, 29 | "language_info": { 30 | "codemirror_mode": { 31 | "name": "ipython", 32 | "version": 2 33 | }, 34 | "file_extension": ".py", 35 | "mimetype": "text/x-python", 36 | "name": "python", 37 | "nbconvert_exporter": "python", 38 | "pygments_lexer": "ipython2", 39 | "version": "2.7.10" 40 | } 41 | }, 42 | "nbformat": 4, 43 | "nbformat_minor": 0 44 | } 45 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/Introduction to Array Based Sequences-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Introduction to Array Based Sequences\n", 8 | "\n", 9 | "In this lecture, we will get a brief overview of the \"sequence\" type object classes available in Python. These are mainly the **list**,**tuple**, and **string** objects. The main commonaility between these object types is the ability to index to access individual elements in the sequence. For example:" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": false 17 | }, 18 | "outputs": [ 19 | { 20 | "data": { 21 | "text/plain": [ 22 | "1" 23 | ] 24 | }, 25 | "execution_count": 1, 26 | "metadata": {}, 27 | "output_type": "execute_result" 28 | } 29 | ], 30 | "source": [ 31 | "l = [1,2,3]\n", 32 | "l[0]" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": 2, 38 | "metadata": { 39 | "collapsed": false 40 | }, 41 | "outputs": [ 42 | { 43 | "data": { 44 | "text/plain": [ 45 | "1" 46 | ] 47 | }, 48 | "execution_count": 2, 49 | "metadata": {}, 50 | "output_type": "execute_result" 51 | } 52 | ], 53 | "source": [ 54 | "t = (1,2,3)\n", 55 | "t[0]" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": 3, 61 | "metadata": { 62 | "collapsed": false 63 | }, 64 | "outputs": [ 65 | { 66 | "data": { 67 | "text/plain": [ 68 | "'1'" 69 | ] 70 | }, 71 | "execution_count": 3, 72 | "metadata": {}, 73 | "output_type": "execute_result" 74 | } 75 | ], 76 | "source": [ 77 | "s = '123'\n", 78 | "s[0]" 79 | ] 80 | }, 81 | { 82 | "cell_type": "markdown", 83 | "metadata": {}, 84 | "source": [ 85 | "## Please refer to the video lecture for the remaining information.\n", 86 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 87 | "# Thanks!" 88 | ] 89 | } 90 | ], 91 | "metadata": { 92 | "kernelspec": { 93 | "display_name": "Python 2", 94 | "language": "python", 95 | "name": "python2" 96 | }, 97 | "language_info": { 98 | "codemirror_mode": { 99 | "name": "ipython", 100 | "version": 2 101 | }, 102 | "file_extension": ".py", 103 | "mimetype": "text/x-python", 104 | "name": "python", 105 | "nbconvert_exporter": "python", 106 | "pygments_lexer": "ipython2", 107 | "version": "2.7.10" 108 | } 109 | }, 110 | "nbformat": 4, 111 | "nbformat_minor": 0 112 | } 113 | -------------------------------------------------------------------------------- /02-Array Sequences/.ipynb_checkpoints/Low Level Arrays-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Low Level Arrays" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": { 13 | "collapsed": true 14 | }, 15 | "source": [ 16 | "## Please refer to the video lecture for the remaining information.\n", 17 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 18 | "# Thanks!" 19 | ] 20 | } 21 | ], 22 | "metadata": { 23 | "kernelspec": { 24 | "display_name": "Python 2", 25 | "language": "python", 26 | "name": "python2" 27 | }, 28 | "language_info": { 29 | "codemirror_mode": { 30 | "name": "ipython", 31 | "version": 2 32 | }, 33 | "file_extension": ".py", 34 | "mimetype": "text/x-python", 35 | "name": "python", 36 | "nbconvert_exporter": "python", 37 | "pygments_lexer": "ipython2", 38 | "version": "2.7.10" 39 | } 40 | }, 41 | "nbformat": 4, 42 | "nbformat_minor": 0 43 | } 44 | -------------------------------------------------------------------------------- /02-Array Sequences/01-Introduction to Array Based Sequences.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Introduction to Array Based Sequences\n", 8 | "\n", 9 | "In this lecture, we will get a brief overview of the \"sequence\" type object classes available in Python. These are mainly the **list**,**tuple**, and **string** objects. The main commonaility between these object types is the ability to index to access individual elements in the sequence. For example:" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "data": { 19 | "text/plain": [ 20 | "1" 21 | ] 22 | }, 23 | "execution_count": 1, 24 | "metadata": {}, 25 | "output_type": "execute_result" 26 | } 27 | ], 28 | "source": [ 29 | "l = [1,2,3]\n", 30 | "l[0]" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 2, 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "data": { 40 | "text/plain": [ 41 | "1" 42 | ] 43 | }, 44 | "execution_count": 2, 45 | "metadata": {}, 46 | "output_type": "execute_result" 47 | } 48 | ], 49 | "source": [ 50 | "t = (1,2,3)\n", 51 | "t[0]" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": 3, 57 | "metadata": {}, 58 | "outputs": [ 59 | { 60 | "data": { 61 | "text/plain": [ 62 | "'1'" 63 | ] 64 | }, 65 | "execution_count": 3, 66 | "metadata": {}, 67 | "output_type": "execute_result" 68 | } 69 | ], 70 | "source": [ 71 | "s = '123'\n", 72 | "s[0]" 73 | ] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "metadata": {}, 78 | "source": [ 79 | "## Please refer to the video lecture for the remaining information.\n", 80 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 81 | "# Thanks!" 82 | ] 83 | } 84 | ], 85 | "metadata": { 86 | "kernelspec": { 87 | "display_name": "Python 3", 88 | "language": "python", 89 | "name": "python3" 90 | }, 91 | "language_info": { 92 | "codemirror_mode": { 93 | "name": "ipython", 94 | "version": 3 95 | }, 96 | "file_extension": ".py", 97 | "mimetype": "text/x-python", 98 | "name": "python", 99 | "nbconvert_exporter": "python", 100 | "pygments_lexer": "ipython3", 101 | "version": "3.8.10" 102 | } 103 | }, 104 | "nbformat": 4, 105 | "nbformat_minor": 1 106 | } 107 | -------------------------------------------------------------------------------- /02-Array Sequences/02-Low Level Arrays.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Low Level Arrays" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": { 13 | "collapsed": true 14 | }, 15 | "source": [ 16 | "## Please refer to the video lecture for the remaining information.\n", 17 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 18 | "# Thanks!" 19 | ] 20 | } 21 | ], 22 | "metadata": { 23 | "kernelspec": { 24 | "display_name": "Python 3", 25 | "language": "python", 26 | "name": "python3" 27 | }, 28 | "language_info": { 29 | "codemirror_mode": { 30 | "name": "ipython", 31 | "version": 3 32 | }, 33 | "file_extension": ".py", 34 | "mimetype": "text/x-python", 35 | "name": "python", 36 | "nbconvert_exporter": "python", 37 | "pygments_lexer": "ipython3", 38 | "version": "3.8.10" 39 | } 40 | }, 41 | "nbformat": 4, 42 | "nbformat_minor": 1 43 | } 44 | -------------------------------------------------------------------------------- /02-Array Sequences/03-Dynamic Array.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Dynamic Arrays\n", 8 | "____\n" 9 | ] 10 | }, 11 | { 12 | "cell_type": "markdown", 13 | "metadata": { 14 | "collapsed": true 15 | }, 16 | "source": [ 17 | "## Please refer to the video lecture for the remaining information.\n", 18 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 19 | "# Thanks!" 20 | ] 21 | } 22 | ], 23 | "metadata": { 24 | "kernelspec": { 25 | "display_name": "Python 2", 26 | "language": "python", 27 | "name": "python2" 28 | }, 29 | "language_info": { 30 | "codemirror_mode": { 31 | "name": "ipython", 32 | "version": 2 33 | }, 34 | "file_extension": ".py", 35 | "mimetype": "text/x-python", 36 | "name": "python", 37 | "nbconvert_exporter": "python", 38 | "pygments_lexer": "ipython2", 39 | "version": "2.7.10" 40 | } 41 | }, 42 | "nbformat": 4, 43 | "nbformat_minor": 0 44 | } 45 | -------------------------------------------------------------------------------- /02-Array Sequences/05-Amortization.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Amortization" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": { 13 | "collapsed": true 14 | }, 15 | "source": [ 16 | "___\n", 17 | "## Please refer to the video lecture for the remaining information.\n", 18 | "## The section consists mostly of video explanations not well-suited for Jupyter Notebooks.\n", 19 | "# Thanks!" 20 | ] 21 | } 22 | ], 23 | "metadata": { 24 | "kernelspec": { 25 | "display_name": "Python 3", 26 | "language": "python", 27 | "name": "python3" 28 | }, 29 | "language_info": { 30 | "codemirror_mode": { 31 | "name": "ipython", 32 | "version": 3 33 | }, 34 | "file_extension": ".py", 35 | "mimetype": "text/x-python", 36 | "name": "python", 37 | "nbconvert_exporter": "python", 38 | "pygments_lexer": "ipython3", 39 | "version": "3.8.10" 40 | } 41 | }, 42 | "nbformat": 4, 43 | "nbformat_minor": 1 44 | } 45 | -------------------------------------------------------------------------------- /02-Array Sequences/06-Array Mini-Project.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "collapsed": true 7 | }, 8 | "source": [ 9 | "# Array Mini-Project\n", 10 | "\n", 11 | "In this mini project we will create our own scoreboard project to understand arrays better!" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": { 18 | "collapsed": true 19 | }, 20 | "outputs": [], 21 | "source": [] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.8.10" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 1 45 | } 46 | -------------------------------------------------------------------------------- /02-Array Sequences/Array Sequences Interview Questions/07-Unique-Characters-in-String/07-Unique Characters in String.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Unique Characters in String\n", 8 | "\n", 9 | "## Problem\n", 10 | "Given a string,determine if it is compreised of all unique characters. For example, the string 'abcde' has all unique characters and should return True. The string 'aabcde' contains duplicate characters and should return false." 11 | ] 12 | }, 13 | { 14 | "cell_type": "markdown", 15 | "metadata": {}, 16 | "source": [ 17 | "## Solution\n", 18 | "Fill out your solution below:" 19 | ] 20 | }, 21 | { 22 | "cell_type": "code", 23 | "execution_count": 3, 24 | "metadata": { 25 | "collapsed": true 26 | }, 27 | "outputs": [], 28 | "source": [ 29 | "def uni_char(s):\n", 30 | " pass" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "# Test Your Solution" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 2, 43 | "metadata": {}, 44 | "outputs": [ 45 | { 46 | "name": "stdout", 47 | "output_type": "stream", 48 | "text": [ 49 | "ALL TEST CASES PASSED\n" 50 | ] 51 | } 52 | ], 53 | "source": [ 54 | "\"\"\"\n", 55 | "RUN THIS CELL TO TEST YOUR CODE>\n", 56 | "\"\"\"\n", 57 | "from nose.tools import assert_equal\n", 58 | "\n", 59 | "\n", 60 | "class TestUnique(object):\n", 61 | "\n", 62 | " def test(self, sol):\n", 63 | " assert_equal(sol(''), True)\n", 64 | " assert_equal(sol('goo'), False)\n", 65 | " assert_equal(sol('abcdefg'), True)\n", 66 | " print('ALL TEST CASES PASSED')\n", 67 | " \n", 68 | "# Run Tests\n", 69 | "t = TestUnique()\n", 70 | "t.test(uni_char)" 71 | ] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "metadata": {}, 76 | "source": [ 77 | "## Good Job!" 78 | ] 79 | } 80 | ], 81 | "metadata": { 82 | "kernelspec": { 83 | "display_name": "Python 3", 84 | "language": "python", 85 | "name": "python3" 86 | }, 87 | "language_info": { 88 | "codemirror_mode": { 89 | "name": "ipython", 90 | "version": 3 91 | }, 92 | "file_extension": ".py", 93 | "mimetype": "text/x-python", 94 | "name": "python", 95 | "nbconvert_exporter": "python", 96 | "pygments_lexer": "ipython3", 97 | "version": "3.8.10" 98 | } 99 | }, 100 | "nbformat": 4, 101 | "nbformat_minor": 1 102 | } 103 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/.ipynb_checkpoints/01-Stacks, Queues, and Deques Overview-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Stacks, Queues, and Deques Overview" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "In this section of the course we will be learning about Stack, Queues, and Deques. These are linear structures. They are similar to arrays, but each of these structures differs by how it adds and removes items.\n", 15 | "\n", 16 | "Here's what to expect in this section:\n", 17 | "\n", 18 | " 1.) A Brief Overview of the Linear Structures\n", 19 | " 2.) An Overview of Stacks\n", 20 | " 3.) An Implementation of a Stack class\n", 21 | " 4.) An Overview of Queues\n", 22 | " 5.) An Implementation of a Queue class\n", 23 | " 6.) An Overview of Deques\n", 24 | " 7.) An Implementation of a Deque class\n", 25 | " \n", 26 | " Then finally a variety of interview questions based on Stacks, Queues, and Deques!\n", 27 | " \n", 28 | "**See the lecture video for a complete breakdown of this Section of the course!**" 29 | ] 30 | } 31 | ], 32 | "metadata": { 33 | "kernelspec": { 34 | "display_name": "Python 3", 35 | "language": "python", 36 | "name": "python3" 37 | }, 38 | "language_info": { 39 | "codemirror_mode": { 40 | "name": "ipython", 41 | "version": 3 42 | }, 43 | "file_extension": ".py", 44 | "mimetype": "text/x-python", 45 | "name": "python", 46 | "nbconvert_exporter": "python", 47 | "pygments_lexer": "ipython3", 48 | "version": "3.8.10" 49 | } 50 | }, 51 | "nbformat": 4, 52 | "nbformat_minor": 1 53 | } 54 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/01-Stacks, Queues, and Deques Overview.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Stacks, Queues, and Deques Overview" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "In this section of the course we will be learning about Stack, Queues, and Deques. These are linear structures. They are similar to arrays, but each of these structures differs by how it adds and removes items.\n", 15 | "\n", 16 | "Here's what to expect in this section:\n", 17 | "\n", 18 | " 1.) A Brief Overview of the Linear Structures\n", 19 | " 2.) An Overview of Stacks\n", 20 | " 3.) An Implementation of a Stack class\n", 21 | " 4.) An Overview of Queues\n", 22 | " 5.) An Implementation of a Queue class\n", 23 | " 6.) An Overview of Deques\n", 24 | " 7.) An Implementation of a Deque class\n", 25 | " \n", 26 | " Then finally a variety of interview questions based on Stacks, Queues, and Deques!\n", 27 | " \n", 28 | "**See the lecture video for a complete breakdown of this Section of the course!**" 29 | ] 30 | } 31 | ], 32 | "metadata": { 33 | "kernelspec": { 34 | "display_name": "Python 3", 35 | "language": "python", 36 | "name": "python3" 37 | }, 38 | "language_info": { 39 | "codemirror_mode": { 40 | "name": "ipython", 41 | "version": 3 42 | }, 43 | "file_extension": ".py", 44 | "mimetype": "text/x-python", 45 | "name": "python", 46 | "nbconvert_exporter": "python", 47 | "pygments_lexer": "ipython3", 48 | "version": "3.8.10" 49 | } 50 | }, 51 | "nbformat": 4, 52 | "nbformat_minor": 1 53 | } 54 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/01-Implement-a-Stack/01-Implement a Stack - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Stack -SOLUTION\n", 8 | "\n", 9 | "**Please refer to the lecture on implementation for a full explanation. Here is the code from that lecture:**" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "class Stack(object):\n", 19 | " \n", 20 | " def __init__(self):\n", 21 | " self.items = []\n", 22 | "\n", 23 | " def isEmpty(self):\n", 24 | " return self.items == []\n", 25 | "\n", 26 | " def push(self, item):\n", 27 | " self.items.append(item)\n", 28 | "\n", 29 | " def pop(self):\n", 30 | " return self.items.pop()\n", 31 | "\n", 32 | " def peek(self):\n", 33 | " return self.items[len(self.items)-1]\n", 34 | "\n", 35 | " def size(self):\n", 36 | " return len(self.items)" 37 | ] 38 | } 39 | ], 40 | "metadata": { 41 | "kernelspec": { 42 | "display_name": "Python 3", 43 | "language": "python", 44 | "name": "python3" 45 | }, 46 | "language_info": { 47 | "codemirror_mode": { 48 | "name": "ipython", 49 | "version": 3 50 | }, 51 | "file_extension": ".py", 52 | "mimetype": "text/x-python", 53 | "name": "python", 54 | "nbconvert_exporter": "python", 55 | "pygments_lexer": "ipython3", 56 | "version": "3.8.10" 57 | } 58 | }, 59 | "nbformat": 4, 60 | "nbformat_minor": 1 61 | } 62 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/01-Implement-a-Stack/01-Implement a Stack .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Stack \n", 8 | "\n", 9 | "A very common interview question is to begin by just implementing a Stack! Try your best to implement your own stack!\n", 10 | "\n", 11 | "It should have the methods:\n", 12 | "\n", 13 | "* Check if its empty\n", 14 | "* Push a new item\n", 15 | "* Pop an item\n", 16 | "* Peek at the top item\n", 17 | "* Return the size" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "metadata": { 24 | "collapsed": true 25 | }, 26 | "outputs": [], 27 | "source": [ 28 | "class Stack(object):\n", 29 | " \n", 30 | " \n", 31 | " # Fill out the Stack Methods here\n", 32 | " pass" 33 | ] 34 | } 35 | ], 36 | "metadata": { 37 | "kernelspec": { 38 | "display_name": "Python 3", 39 | "language": "python", 40 | "name": "python3" 41 | }, 42 | "language_info": { 43 | "codemirror_mode": { 44 | "name": "ipython", 45 | "version": 3 46 | }, 47 | "file_extension": ".py", 48 | "mimetype": "text/x-python", 49 | "name": "python", 50 | "nbconvert_exporter": "python", 51 | "pygments_lexer": "ipython3", 52 | "version": "3.8.10" 53 | } 54 | }, 55 | "nbformat": 4, 56 | "nbformat_minor": 1 57 | } 58 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/02-Implement-a-Queue/02-Implement a Queue - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Queue - SOLUTION\n", 8 | "\n", 9 | "**Please refer to the Implementation of Queue lecture for a full explanation. The code from that lecture is below:**" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "class Queue:\n", 19 | " def __init__(self):\n", 20 | " self.items = []\n", 21 | "\n", 22 | " def isEmpty(self):\n", 23 | " return self.items == []\n", 24 | "\n", 25 | " def enqueue(self, item):\n", 26 | " self.items.insert(0,item)\n", 27 | "\n", 28 | " def dequeue(self):\n", 29 | " return self.items.pop()\n", 30 | "\n", 31 | " def size(self):\n", 32 | " return len(self.items)" 33 | ] 34 | } 35 | ], 36 | "metadata": { 37 | "kernelspec": { 38 | "display_name": "Python 3", 39 | "language": "python", 40 | "name": "python3" 41 | }, 42 | "language_info": { 43 | "codemirror_mode": { 44 | "name": "ipython", 45 | "version": 3 46 | }, 47 | "file_extension": ".py", 48 | "mimetype": "text/x-python", 49 | "name": "python", 50 | "nbconvert_exporter": "python", 51 | "pygments_lexer": "ipython3", 52 | "version": "3.8.10" 53 | } 54 | }, 55 | "nbformat": 4, 56 | "nbformat_minor": 1 57 | } 58 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/02-Implement-a-Queue/02-Implement a Queue.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Queue\n", 8 | "\n", 9 | "It's very common to be asked to implement a Queue class! The class should be able to do the following:\n", 10 | "\n", 11 | "* Check if Queue is Empty\n", 12 | "* Enqueue\n", 13 | "* Dequeue\n", 14 | "* Return the size of the Queue" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "class Queue(object):\n", 26 | " pass" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 3", 33 | "language": "python", 34 | "name": "python3" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 3 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython3", 46 | "version": "3.8.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 1 51 | } 52 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/03-Implement-a-Deque/03-Implement a Deque - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Deque - SOLUTION\n", 8 | "\n", 9 | "**Please refer to the Implementation of Deque lecture for a full explanation. The code from that lecture is below:**" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "class Deque:\n", 19 | " def __init__(self):\n", 20 | " self.items = []\n", 21 | "\n", 22 | " def isEmpty(self):\n", 23 | " return self.items == []\n", 24 | "\n", 25 | " def addFront(self, item):\n", 26 | " self.items.append(item)\n", 27 | "\n", 28 | " def addRear(self, item):\n", 29 | " self.items.insert(0,item)\n", 30 | "\n", 31 | " def removeFront(self):\n", 32 | " return self.items.pop()\n", 33 | "\n", 34 | " def removeRear(self):\n", 35 | " return self.items.pop(0)\n", 36 | "\n", 37 | " def size(self):\n", 38 | " return len(self.items)" 39 | ] 40 | } 41 | ], 42 | "metadata": { 43 | "kernelspec": { 44 | "display_name": "Python 3", 45 | "language": "python", 46 | "name": "python3" 47 | }, 48 | "language_info": { 49 | "codemirror_mode": { 50 | "name": "ipython", 51 | "version": 3 52 | }, 53 | "file_extension": ".py", 54 | "mimetype": "text/x-python", 55 | "name": "python", 56 | "nbconvert_exporter": "python", 57 | "pygments_lexer": "ipython3", 58 | "version": "3.8.10" 59 | } 60 | }, 61 | "nbformat": 4, 62 | "nbformat_minor": 1 63 | } 64 | -------------------------------------------------------------------------------- /03-Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/03-Implement-a-Deque/03-Implement a Deque .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Deque \n", 8 | "\n", 9 | "Finally, implement a Deque class! It should be able to do the following:\n", 10 | "\n", 11 | "* Check if its empty\n", 12 | "* Add to both front and rear\n", 13 | "* Remove from Front and Rear\n", 14 | "* Check the Size" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "class Deque(object):\n", 26 | " pass" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 3", 33 | "language": "python", 34 | "name": "python3" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 3 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython3", 46 | "version": "3.8.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 1 51 | } 52 | -------------------------------------------------------------------------------- /04-Linked Lists/.ipynb_checkpoints/01-Linked List Overview-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Linked Lists\n", 8 | "\n", 9 | "In this lecture we will get a brief overview of what we will learn in the Linked List section of this course.\n", 10 | "\n", 11 | "We will cover the following topics:\n", 12 | "\n", 13 | "* Singly Linked Lists\n", 14 | "* Implementing a Singly Linked List\n", 15 | "* Doubly Linked Lists\n", 16 | "* Implementing a Doubly Linked list\n", 17 | "* Linked Lists Interview Problems" 18 | ] 19 | } 20 | ], 21 | "metadata": { 22 | "kernelspec": { 23 | "display_name": "Python 3", 24 | "language": "python", 25 | "name": "python3" 26 | }, 27 | "language_info": { 28 | "codemirror_mode": { 29 | "name": "ipython", 30 | "version": 3 31 | }, 32 | "file_extension": ".py", 33 | "mimetype": "text/x-python", 34 | "name": "python", 35 | "nbconvert_exporter": "python", 36 | "pygments_lexer": "ipython3", 37 | "version": "3.8.10" 38 | } 39 | }, 40 | "nbformat": 4, 41 | "nbformat_minor": 1 42 | } 43 | -------------------------------------------------------------------------------- /04-Linked Lists/.ipynb_checkpoints/02-Singly Linked Lists-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "collapsed": true 7 | }, 8 | "source": [ 9 | "# Singly Linked Lists\n", 10 | "\n", 11 | "**Please refer to the Lecture Video for full Explanation of Singly Linked Lists**" 12 | ] 13 | } 14 | ], 15 | "metadata": { 16 | "kernelspec": { 17 | "display_name": "Python 3", 18 | "language": "python", 19 | "name": "python3" 20 | }, 21 | "language_info": { 22 | "codemirror_mode": { 23 | "name": "ipython", 24 | "version": 3 25 | }, 26 | "file_extension": ".py", 27 | "mimetype": "text/x-python", 28 | "name": "python", 29 | "nbconvert_exporter": "python", 30 | "pygments_lexer": "ipython3", 31 | "version": "3.8.10" 32 | } 33 | }, 34 | "nbformat": 4, 35 | "nbformat_minor": 1 36 | } 37 | -------------------------------------------------------------------------------- /04-Linked Lists/.ipynb_checkpoints/04-Doubly Linked Lists-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Doubly Linked Lists\n", 8 | "\n", 9 | "**Please refer to the video lecture for the full explanation of the Doubly Linked Lists**" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.10" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 1 34 | } 35 | -------------------------------------------------------------------------------- /04-Linked Lists/.ipynb_checkpoints/05-Doubly Linked List Implementation-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Doubly Linked List Implementation\n", 8 | "\n", 9 | "In this lecture we will implement a Doubly Linked List " 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "class DoublyLinkedListNode(object):\n", 19 | " \n", 20 | " def __init__(self,value):\n", 21 | " \n", 22 | " self.value = value\n", 23 | " self.next_node = None\n", 24 | " self.prev_node = None" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "Now that we have our node that can reference next *and* previous values, let's begin to build out our linked list!" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 2, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "a = DoublyLinkedListNode(1)\n", 41 | "b = DoublyLinkedListNode(2)\n", 42 | "c = DoublyLinkedListNode(3)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 3, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "# Setting b after a\n", 52 | "b.prev_node = a\n", 53 | "a.next_node = b" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": 4, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "# Setting c after a\n", 63 | "b.next_node = c\n", 64 | "c.prev_node = b" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "metadata": {}, 70 | "source": [ 71 | "Having a Doubly Linked list allows us to go though our Linked List forwards **and** backwards." 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "# Good Job!" 79 | ] 80 | } 81 | ], 82 | "metadata": { 83 | "kernelspec": { 84 | "display_name": "Python 3", 85 | "language": "python", 86 | "name": "python3" 87 | }, 88 | "language_info": { 89 | "codemirror_mode": { 90 | "name": "ipython", 91 | "version": 3 92 | }, 93 | "file_extension": ".py", 94 | "mimetype": "text/x-python", 95 | "name": "python", 96 | "nbconvert_exporter": "python", 97 | "pygments_lexer": "ipython3", 98 | "version": "3.8.10" 99 | } 100 | }, 101 | "nbformat": 4, 102 | "nbformat_minor": 1 103 | } 104 | -------------------------------------------------------------------------------- /04-Linked Lists/01-Linked List Overview.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Linked Lists\n", 8 | "\n", 9 | "In this lecture we will get a brief overview of what we will learn in the Linked List section of this course.\n", 10 | "\n", 11 | "We will cover the following topics:\n", 12 | "\n", 13 | "* Singly Linked Lists\n", 14 | "* Implementing a Singly Linked List\n", 15 | "* Doubly Linked Lists\n", 16 | "* Implementing a Doubly Linked list\n", 17 | "* Linked Lists Interview Problems" 18 | ] 19 | } 20 | ], 21 | "metadata": { 22 | "kernelspec": { 23 | "display_name": "Python 3", 24 | "language": "python", 25 | "name": "python3" 26 | }, 27 | "language_info": { 28 | "codemirror_mode": { 29 | "name": "ipython", 30 | "version": 3 31 | }, 32 | "file_extension": ".py", 33 | "mimetype": "text/x-python", 34 | "name": "python", 35 | "nbconvert_exporter": "python", 36 | "pygments_lexer": "ipython3", 37 | "version": "3.8.10" 38 | } 39 | }, 40 | "nbformat": 4, 41 | "nbformat_minor": 1 42 | } 43 | -------------------------------------------------------------------------------- /04-Linked Lists/02-Singly Linked Lists.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "collapsed": true 7 | }, 8 | "source": [ 9 | "# Singly Linked Lists\n", 10 | "\n", 11 | "**Please refer to the Lecture Video for full Explanation of Singly Linked Lists**" 12 | ] 13 | } 14 | ], 15 | "metadata": { 16 | "kernelspec": { 17 | "display_name": "Python 3", 18 | "language": "python", 19 | "name": "python3" 20 | }, 21 | "language_info": { 22 | "codemirror_mode": { 23 | "name": "ipython", 24 | "version": 3 25 | }, 26 | "file_extension": ".py", 27 | "mimetype": "text/x-python", 28 | "name": "python", 29 | "nbconvert_exporter": "python", 30 | "pygments_lexer": "ipython3", 31 | "version": "3.8.10" 32 | } 33 | }, 34 | "nbformat": 4, 35 | "nbformat_minor": 1 36 | } 37 | -------------------------------------------------------------------------------- /04-Linked Lists/04-Doubly Linked Lists.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Doubly Linked Lists\n", 8 | "\n", 9 | "**Please refer to the video lecture for the full explanation of the Doubly Linked Lists**" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.10" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 1 34 | } 35 | -------------------------------------------------------------------------------- /04-Linked Lists/05-Doubly Linked List Implementation.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Doubly Linked List Implementation\n", 8 | "\n", 9 | "In this lecture we will implement a Doubly Linked List " 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "class DoublyLinkedListNode(object):\n", 19 | " \n", 20 | " def __init__(self,value):\n", 21 | " \n", 22 | " self.value = value\n", 23 | " self.next_node = None\n", 24 | " self.prev_node = None" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "Now that we have our node that can reference next *and* previous values, let's begin to build out our linked list!" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 2, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "a = DoublyLinkedListNode(1)\n", 41 | "b = DoublyLinkedListNode(2)\n", 42 | "c = DoublyLinkedListNode(3)" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 3, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "# Setting b after a\n", 52 | "b.prev_node = a\n", 53 | "a.next_node = b" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": 4, 59 | "metadata": {}, 60 | "outputs": [], 61 | "source": [ 62 | "# Setting c after a\n", 63 | "b.next_node = c\n", 64 | "c.prev_node = b" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "metadata": {}, 70 | "source": [ 71 | "Having a Doubly Linked list allows us to go though our Linked List forwards **and** backwards." 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": {}, 77 | "source": [ 78 | "# Good Job!" 79 | ] 80 | } 81 | ], 82 | "metadata": { 83 | "kernelspec": { 84 | "display_name": "Python 3", 85 | "language": "python", 86 | "name": "python3" 87 | }, 88 | "language_info": { 89 | "codemirror_mode": { 90 | "name": "ipython", 91 | "version": 3 92 | }, 93 | "file_extension": ".py", 94 | "mimetype": "text/x-python", 95 | "name": "python", 96 | "nbconvert_exporter": "python", 97 | "pygments_lexer": "ipython3", 98 | "version": "3.8.10" 99 | } 100 | }, 101 | "nbformat": 4, 102 | "nbformat_minor": 1 103 | } 104 | -------------------------------------------------------------------------------- /04-Linked Lists/Linked Lists Interview Problems/04-Implement-a-Doubly-Linked-List/04-Implement a Doubly Linked List.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Doubly Linked List\n", 8 | "\n", 9 | "For this interview problem, implement a node class and show how it can be used to create a doubly linked list." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": true 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "class Node(object):\n", 21 | " pass" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 2, 27 | "metadata": { 28 | "collapsed": true 29 | }, 30 | "outputs": [], 31 | "source": [ 32 | "# Create a Doubly Linked List here" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "# Test Your Solution\n", 40 | "Note that there is no test for this solution (because it would give away the answer structure).\n", 41 | "\n", 42 | "Check out the Implement a Linked List Solution Notebook for the answer to this interview problem, as well as the answer for the implementation of a singly linked list." 43 | ] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 3", 49 | "language": "python", 50 | "name": "python3" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 3 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython3", 62 | "version": "3.8.10" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 1 67 | } 68 | -------------------------------------------------------------------------------- /04-Linked Lists/Linked Lists Interview Problems/05-Implement-a-Singly-Linked-List/05-Implement a Singly Linked List.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Singly Linked List\n", 8 | "\n", 9 | "For this interview problem, create a node class and show how it can be used to create a Singly Linked List" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": true 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "class Node(object):\n", 21 | " pass" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": { 28 | "collapsed": true 29 | }, 30 | "outputs": [], 31 | "source": [ 32 | "# Create a Singly Linked List here" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "# Test Your Solution\n", 40 | "\n", 41 | "Note that there is no test for this solution (because it would give away the answer structure).\n", 42 | "\n", 43 | "Check out the Implement a Linked List Solution Notebook for the answer to this interview problem, as well as the answer for the implementation of a doubly linked list." 44 | ] 45 | } 46 | ], 47 | "metadata": { 48 | "kernelspec": { 49 | "display_name": "Python 3", 50 | "language": "python", 51 | "name": "python3" 52 | }, 53 | "language_info": { 54 | "codemirror_mode": { 55 | "name": "ipython", 56 | "version": 3 57 | }, 58 | "file_extension": ".py", 59 | "mimetype": "text/x-python", 60 | "name": "python", 61 | "nbconvert_exporter": "python", 62 | "pygments_lexer": "ipython3", 63 | "version": "3.8.10" 64 | } 65 | }, 66 | "nbformat": 4, 67 | "nbformat_minor": 1 68 | } 69 | -------------------------------------------------------------------------------- /06-Trees/.ipynb_checkpoints/01-Tree Representation Implementation (Lists)-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Tree Representation Implementation (Lists)\n", 8 | "\n", 9 | "Below is a representation of a Tree using a list of lists. Refer to the video lecture for an explanation and a live coding demonstration!" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "def BinaryTree(r):\n", 19 | " return [r, [], []]\n", 20 | "\n", 21 | "def insertLeft(root,newBranch):\n", 22 | " t = root.pop(1)\n", 23 | " if len(t) > 1:\n", 24 | " root.insert(1,[newBranch,t,[]])\n", 25 | " else:\n", 26 | " root.insert(1,[newBranch, [], []])\n", 27 | " return root\n", 28 | "\n", 29 | "def insertRight(root,newBranch):\n", 30 | " t = root.pop(2)\n", 31 | " if len(t) > 1:\n", 32 | " root.insert(2,[newBranch,[],t])\n", 33 | " else:\n", 34 | " root.insert(2,[newBranch,[],[]])\n", 35 | " return root\n", 36 | "\n", 37 | "def getRootVal(root):\n", 38 | " return root[0]\n", 39 | "\n", 40 | "def setRootVal(root,newVal):\n", 41 | " root[0] = newVal\n", 42 | "\n", 43 | "def getLeftChild(root):\n", 44 | " return root[1]\n", 45 | "\n", 46 | "def getRightChild(root):\n", 47 | " return root[2]" 48 | ] 49 | } 50 | ], 51 | "metadata": { 52 | "kernelspec": { 53 | "display_name": "Python 3", 54 | "language": "python", 55 | "name": "python3" 56 | }, 57 | "language_info": { 58 | "codemirror_mode": { 59 | "name": "ipython", 60 | "version": 3 61 | }, 62 | "file_extension": ".py", 63 | "mimetype": "text/x-python", 64 | "name": "python", 65 | "nbconvert_exporter": "python", 66 | "pygments_lexer": "ipython3", 67 | "version": "3.8.10" 68 | } 69 | }, 70 | "nbformat": 4, 71 | "nbformat_minor": 1 72 | } 73 | -------------------------------------------------------------------------------- /06-Trees/01-Tree Representation Implementation (Lists).ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Tree Representation Implementation (Lists)\n", 8 | "\n", 9 | "Below is a representation of a Tree using a list of lists. Refer to the video lecture for an explanation and a live coding demonstration!" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "def BinaryTree(r):\n", 19 | " return [r, [], []]\n", 20 | "\n", 21 | "def insertLeft(root,newBranch):\n", 22 | " t = root.pop(1)\n", 23 | " if len(t) > 1:\n", 24 | " root.insert(1,[newBranch,t,[]])\n", 25 | " else:\n", 26 | " root.insert(1,[newBranch, [], []])\n", 27 | " return root\n", 28 | "\n", 29 | "def insertRight(root,newBranch):\n", 30 | " t = root.pop(2)\n", 31 | " if len(t) > 1:\n", 32 | " root.insert(2,[newBranch,[],t])\n", 33 | " else:\n", 34 | " root.insert(2,[newBranch,[],[]])\n", 35 | " return root\n", 36 | "\n", 37 | "def getRootVal(root):\n", 38 | " return root[0]\n", 39 | "\n", 40 | "def setRootVal(root,newVal):\n", 41 | " root[0] = newVal\n", 42 | "\n", 43 | "def getLeftChild(root):\n", 44 | " return root[1]\n", 45 | "\n", 46 | "def getRightChild(root):\n", 47 | " return root[2]" 48 | ] 49 | } 50 | ], 51 | "metadata": { 52 | "kernelspec": { 53 | "display_name": "Python 3", 54 | "language": "python", 55 | "name": "python3" 56 | }, 57 | "language_info": { 58 | "codemirror_mode": { 59 | "name": "ipython", 60 | "version": 3 61 | }, 62 | "file_extension": ".py", 63 | "mimetype": "text/x-python", 64 | "name": "python", 65 | "nbconvert_exporter": "python", 66 | "pygments_lexer": "ipython3", 67 | "version": "3.8.10" 68 | } 69 | }, 70 | "nbformat": 4, 71 | "nbformat_minor": 1 72 | } 73 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/.ipynb_checkpoints/01-Binary Search Tree Check-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Binary Search Tree Check \n", 8 | "\n", 9 | "## Problem Statement\n", 10 | "\n", 11 | "Given a binary tree, check whether it’s a binary search tree or not.\n", 12 | "\n", 13 | "** Again, no solution cell, just worry about your code making sense logically. Hint: Think about tree traversals. **\n", 14 | "\n", 15 | "## Solution\n", 16 | "\n", 17 | "Fill out your solution below:" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "# Code goes Here" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "This is a classic interview problem, so feel free to just Google search \"Validate BST\" for more information on this problem!" 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "kernelspec": { 39 | "display_name": "Python 3", 40 | "language": "python", 41 | "name": "python3" 42 | }, 43 | "language_info": { 44 | "codemirror_mode": { 45 | "name": "ipython", 46 | "version": 3 47 | }, 48 | "file_extension": ".py", 49 | "mimetype": "text/x-python", 50 | "name": "python", 51 | "nbconvert_exporter": "python", 52 | "pygments_lexer": "ipython3", 53 | "version": "3.8.10" 54 | } 55 | }, 56 | "nbformat": 4, 57 | "nbformat_minor": 1 58 | } 59 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/.ipynb_checkpoints/02-Tree Level Order Print-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Tree Level Order Print \n", 8 | "\n", 9 | "Given a binary tree of integers, print it in level order. The output will contain space between the numbers in the same level, and new line between different levels. For example, if the tree is: \n", 10 | "___\n", 11 | "![title](tree_print.png)\n", 12 | "___\n", 13 | "The output should be: \n", 14 | "\n", 15 | " 1 \n", 16 | " 2 3 \n", 17 | " 4 5 6" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "## Solution\n", 25 | "\n", 26 | "Fill out your solution below:" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 1, 32 | "metadata": { 33 | "collapsed": true 34 | }, 35 | "outputs": [], 36 | "source": [ 37 | "class Node:\n", 38 | " def __init__(self, val=None):\n", 39 | " self.left = None\n", 40 | " self.right = None\n", 41 | " self.val = val " 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "metadata": { 48 | "collapsed": true 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "def levelOrderPrint(tree):\n", 53 | " #Code here\n", 54 | " pass" 55 | ] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "Python 3", 61 | "language": "python", 62 | "name": "python3" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": { 66 | "name": "ipython", 67 | "version": 3 68 | }, 69 | "file_extension": ".py", 70 | "mimetype": "text/x-python", 71 | "name": "python", 72 | "nbconvert_exporter": "python", 73 | "pygments_lexer": "ipython3", 74 | "version": "3.8.10" 75 | } 76 | }, 77 | "nbformat": 4, 78 | "nbformat_minor": 1 79 | } 80 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/.ipynb_checkpoints/03-Trim a Binary Search Tree -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Trim a Binary Search Tree \n", 8 | "\n", 9 | "## Problem Statement\n", 10 | "\n", 11 | "Given the root of a binary search tree and 2 numbers min and max, trim the tree such that all the numbers in the new tree are between min and max (inclusive). The resulting tree should still be a valid binary search tree. So, if we get this tree as input:\n", 12 | "___\n", 13 | "\n", 14 | "![title](bst1.png)\n", 15 | "___\n", 16 | "and we’re given **min value as 5** and **max value as 13**, then the resulting binary search tree should be: \n", 17 | "___\n", 18 | "![title](bst_trim.png)\n", 19 | "___\n", 20 | "We should remove all the nodes whose value is not between min and max. \n", 21 | "\n", 22 | "___\n", 23 | "** Feel free to reference the lecture on Binary Search Tree for the node class, but what it more important here is the logic of your function. In which case your function should be in the form:**" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 1, 29 | "metadata": { 30 | "collapsed": true 31 | }, 32 | "outputs": [], 33 | "source": [ 34 | "def trimBST(tree,minVal,maxVal):\n", 35 | " \n", 36 | " print(tree.left) # LeftChild\n", 37 | " print(tree.right) # Right Child\n", 38 | " print(tree.val) # Node's value\n", 39 | " \n", 40 | " pass\n", 41 | "\n", 42 | "# Use tree.left , tree.right , and tree.val as your methods to call" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "** There is no solution cell because the nature of the code should be more logical and a test would essentially give away the answer. Just focus your answer to fill out the logic of the solution using the methods described above **\n", 50 | "\n", 51 | "## Best of luck!" 52 | ] 53 | } 54 | ], 55 | "metadata": { 56 | "kernelspec": { 57 | "display_name": "Python 3", 58 | "language": "python", 59 | "name": "python3" 60 | }, 61 | "language_info": { 62 | "codemirror_mode": { 63 | "name": "ipython", 64 | "version": 3 65 | }, 66 | "file_extension": ".py", 67 | "mimetype": "text/x-python", 68 | "name": "python", 69 | "nbconvert_exporter": "python", 70 | "pygments_lexer": "ipython3", 71 | "version": "3.8.10" 72 | } 73 | }, 74 | "nbformat": 4, 75 | "nbformat_minor": 1 76 | } 77 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/01-Binary-Search-Tree-Check/01-Binary Search Tree Check.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Binary Search Tree Check \n", 8 | "\n", 9 | "## Problem Statement\n", 10 | "\n", 11 | "Given a binary tree, check whether it’s a binary search tree or not.\n", 12 | "\n", 13 | "** Again, no solution cell, just worry about your code making sense logically. Hint: Think about tree traversals. **\n", 14 | "\n", 15 | "## Solution\n", 16 | "\n", 17 | "Fill out your solution below:" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "metadata": {}, 24 | "outputs": [], 25 | "source": [ 26 | "# Code goes Here" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "This is a classic interview problem, so feel free to just Google search \"Validate BST\" for more information on this problem!" 34 | ] 35 | } 36 | ], 37 | "metadata": { 38 | "kernelspec": { 39 | "display_name": "Python 3", 40 | "language": "python", 41 | "name": "python3" 42 | }, 43 | "language_info": { 44 | "codemirror_mode": { 45 | "name": "ipython", 46 | "version": 3 47 | }, 48 | "file_extension": ".py", 49 | "mimetype": "text/x-python", 50 | "name": "python", 51 | "nbconvert_exporter": "python", 52 | "pygments_lexer": "ipython3", 53 | "version": "3.8.10" 54 | } 55 | }, 56 | "nbformat": 4, 57 | "nbformat_minor": 1 58 | } 59 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/02-Tree-Level-Order-Print/.ipynb_checkpoints/02-Tree Level Order Print-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Tree Level Order Print \n", 8 | "\n", 9 | "Given a binary tree of integers, print it in level order. The output will contain space between the numbers in the same level, and new line between different levels. For example, if the tree is: \n", 10 | "___\n", 11 | "![title](tree_print.png)\n", 12 | "___\n", 13 | "The output should be: \n", 14 | "\n", 15 | " 1 \n", 16 | " 2 3 \n", 17 | " 4 5 6" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "## Solution\n", 25 | "\n", 26 | "Fill out your solution below:" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 1, 32 | "metadata": { 33 | "collapsed": true 34 | }, 35 | "outputs": [], 36 | "source": [ 37 | "class Node:\n", 38 | " def __init__(self, val=None):\n", 39 | " self.left = None\n", 40 | " self.right = None\n", 41 | " self.val = val " 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "metadata": { 48 | "collapsed": true 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "def levelOrderPrint(tree):\n", 53 | " #Code here\n", 54 | " pass" 55 | ] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "Python 3", 61 | "language": "python", 62 | "name": "python3" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": { 66 | "name": "ipython", 67 | "version": 3 68 | }, 69 | "file_extension": ".py", 70 | "mimetype": "text/x-python", 71 | "name": "python", 72 | "nbconvert_exporter": "python", 73 | "pygments_lexer": "ipython3", 74 | "version": "3.8.10" 75 | } 76 | }, 77 | "nbformat": 4, 78 | "nbformat_minor": 1 79 | } 80 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/02-Tree-Level-Order-Print/02-Tree Level Order Print.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Tree Level Order Print \n", 8 | "\n", 9 | "Given a binary tree of integers, print it in level order. The output will contain space between the numbers in the same level, and new line between different levels. For example, if the tree is: \n", 10 | "___\n", 11 | "![title](tree_print.png)\n", 12 | "___\n", 13 | "The output should be: \n", 14 | "\n", 15 | " 1 \n", 16 | " 2 3 \n", 17 | " 4 5 6" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "## Solution\n", 25 | "\n", 26 | "Fill out your solution below:" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 1, 32 | "metadata": { 33 | "collapsed": true 34 | }, 35 | "outputs": [], 36 | "source": [ 37 | "class Node:\n", 38 | " def __init__(self, val=None):\n", 39 | " self.left = None\n", 40 | " self.right = None\n", 41 | " self.val = val " 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "metadata": { 48 | "collapsed": true 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "def levelOrderPrint(tree):\n", 53 | " #Code here\n", 54 | " pass" 55 | ] 56 | } 57 | ], 58 | "metadata": { 59 | "kernelspec": { 60 | "display_name": "Python 3", 61 | "language": "python", 62 | "name": "python3" 63 | }, 64 | "language_info": { 65 | "codemirror_mode": { 66 | "name": "ipython", 67 | "version": 3 68 | }, 69 | "file_extension": ".py", 70 | "mimetype": "text/x-python", 71 | "name": "python", 72 | "nbconvert_exporter": "python", 73 | "pygments_lexer": "ipython3", 74 | "version": "3.8.10" 75 | } 76 | }, 77 | "nbformat": 4, 78 | "nbformat_minor": 1 79 | } 80 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/02-Tree-Level-Order-Print/tree_print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmportilla/Python-for-Algorithms--Data-Structures--and-Interviews/8ad81ec1459306c2ddd9b0af8a24fa5f68e35ed2/06-Trees/Trees Interview Problems/02-Tree-Level-Order-Print/tree_print.png -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/03-Trim-a-Binary-Search-Tree/.ipynb_checkpoints/03-Trim a Binary Search Tree -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Trim a Binary Search Tree \n", 8 | "\n", 9 | "## Problem Statement\n", 10 | "\n", 11 | "Given the root of a binary search tree and 2 numbers min and max, trim the tree such that all the numbers in the new tree are between min and max (inclusive). The resulting tree should still be a valid binary search tree. So, if we get this tree as input:\n", 12 | "___\n", 13 | "\n", 14 | "![title](bst1.png)\n", 15 | "___\n", 16 | "and we’re given **min value as 5** and **max value as 13**, then the resulting binary search tree should be: \n", 17 | "___\n", 18 | "![title](bst_trim.png)\n", 19 | "___\n", 20 | "We should remove all the nodes whose value is not between min and max. \n", 21 | "\n", 22 | "___\n", 23 | "** Feel free to reference the lecture on Binary Search Tree for the node class, but what it more important here is the logic of your function. In which case your function should be in the form:**" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 1, 29 | "metadata": { 30 | "collapsed": true 31 | }, 32 | "outputs": [], 33 | "source": [ 34 | "def trimBST(tree,minVal,maxVal):\n", 35 | " \n", 36 | " print(tree.left) # LeftChild\n", 37 | " print(tree.right) # Right Child\n", 38 | " print(tree.val) # Node's value\n", 39 | " \n", 40 | " pass\n", 41 | "\n", 42 | "# Use tree.left , tree.right , and tree.val as your methods to call" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "** There is no solution cell because the nature of the code should be more logical and a test would essentially give away the answer. Just focus your answer to fill out the logic of the solution using the methods described above **\n", 50 | "\n", 51 | "## Best of luck!" 52 | ] 53 | } 54 | ], 55 | "metadata": { 56 | "kernelspec": { 57 | "display_name": "Python 3", 58 | "language": "python", 59 | "name": "python3" 60 | }, 61 | "language_info": { 62 | "codemirror_mode": { 63 | "name": "ipython", 64 | "version": 3 65 | }, 66 | "file_extension": ".py", 67 | "mimetype": "text/x-python", 68 | "name": "python", 69 | "nbconvert_exporter": "python", 70 | "pygments_lexer": "ipython3", 71 | "version": "3.8.10" 72 | } 73 | }, 74 | "nbformat": 4, 75 | "nbformat_minor": 1 76 | } 77 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/03-Trim-a-Binary-Search-Tree/03-Trim a Binary Search Tree .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Trim a Binary Search Tree \n", 8 | "\n", 9 | "## Problem Statement\n", 10 | "\n", 11 | "Given the root of a binary search tree and 2 numbers min and max, trim the tree such that all the numbers in the new tree are between min and max (inclusive). The resulting tree should still be a valid binary search tree. So, if we get this tree as input:\n", 12 | "___\n", 13 | "\n", 14 | "![title](bst1.png)\n", 15 | "___\n", 16 | "and we’re given **min value as 5** and **max value as 13**, then the resulting binary search tree should be: \n", 17 | "___\n", 18 | "![title](bst_trim.png)\n", 19 | "___\n", 20 | "We should remove all the nodes whose value is not between min and max. \n", 21 | "\n", 22 | "___\n", 23 | "** Feel free to reference the lecture on Binary Search Tree for the node class, but what it more important here is the logic of your function. In which case your function should be in the form:**" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 1, 29 | "metadata": { 30 | "collapsed": true 31 | }, 32 | "outputs": [], 33 | "source": [ 34 | "def trimBST(tree,minVal,maxVal):\n", 35 | " \n", 36 | " print(tree.left) # LeftChild\n", 37 | " print(tree.right) # Right Child\n", 38 | " print(tree.val) # Node's value\n", 39 | " \n", 40 | " pass\n", 41 | "\n", 42 | "# Use tree.left , tree.right , and tree.val as your methods to call" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "** There is no solution cell because the nature of the code should be more logical and a test would essentially give away the answer. Just focus your answer to fill out the logic of the solution using the methods described above **\n", 50 | "\n", 51 | "## Best of luck!" 52 | ] 53 | } 54 | ], 55 | "metadata": { 56 | "kernelspec": { 57 | "display_name": "Python 3", 58 | "language": "python", 59 | "name": "python3" 60 | }, 61 | "language_info": { 62 | "codemirror_mode": { 63 | "name": "ipython", 64 | "version": 3 65 | }, 66 | "file_extension": ".py", 67 | "mimetype": "text/x-python", 68 | "name": "python", 69 | "nbconvert_exporter": "python", 70 | "pygments_lexer": "ipython3", 71 | "version": "3.8.10" 72 | } 73 | }, 74 | "nbformat": 4, 75 | "nbformat_minor": 1 76 | } 77 | -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/03-Trim-a-Binary-Search-Tree/bst1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmportilla/Python-for-Algorithms--Data-Structures--and-Interviews/8ad81ec1459306c2ddd9b0af8a24fa5f68e35ed2/06-Trees/Trees Interview Problems/03-Trim-a-Binary-Search-Tree/bst1.png -------------------------------------------------------------------------------- /06-Trees/Trees Interview Problems/03-Trim-a-Binary-Search-Tree/bst_trim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmportilla/Python-for-Algorithms--Data-Structures--and-Interviews/8ad81ec1459306c2ddd9b0af8a24fa5f68e35ed2/06-Trees/Trees Interview Problems/03-Trim-a-Binary-Search-Tree/bst_trim.png -------------------------------------------------------------------------------- /08-Graphs/Graph Interview Questions/.ipynb_checkpoints/01-Implement a Graph-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Graph Class!\n", 8 | "\n", 9 | "That's it! \n", 10 | "\n", 11 | "Best of luck and reference the video lecture for any questions!\n", 12 | "\n", 13 | "You have to fully worked out implementations in the lectures, so make sure to refer to them!" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "# Good Luck!" 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.8.10" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 1 45 | } 46 | -------------------------------------------------------------------------------- /08-Graphs/Graph Interview Questions/.ipynb_checkpoints/02-Implement Depth First Search Algorithm-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Depth First Search Algorithm" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "For this problem, implement a DFS Algorithm! You can assume that the graph is in the simplified form:" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 8, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "graph = {'A': set(['B', 'C']),\n", 26 | " 'B': set(['A', 'D', 'E']),\n", 27 | " 'C': set(['A', 'F']),\n", 28 | " 'D': set(['B']),\n", 29 | " 'E': set(['B', 'F']),\n", 30 | " 'F': set(['C', 'E'])}" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "# Good Luck!" 38 | ] 39 | } 40 | ], 41 | "metadata": { 42 | "kernelspec": { 43 | "display_name": "Python 3", 44 | "language": "python", 45 | "name": "python3" 46 | }, 47 | "language_info": { 48 | "codemirror_mode": { 49 | "name": "ipython", 50 | "version": 3 51 | }, 52 | "file_extension": ".py", 53 | "mimetype": "text/x-python", 54 | "name": "python", 55 | "nbconvert_exporter": "python", 56 | "pygments_lexer": "ipython3", 57 | "version": "3.8.10" 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 1 62 | } 63 | -------------------------------------------------------------------------------- /08-Graphs/Graph Interview Questions/.ipynb_checkpoints/03-Implement Breadth First Search Algorithm-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Breadth First Search Algorithm" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "For this problem, implement a BFS Algorithm! You can assume that the graph is in the simplified form:" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 8, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "graph = {'A': set(['B', 'C']),\n", 26 | " 'B': set(['A', 'D', 'E']),\n", 27 | " 'C': set(['A', 'F']),\n", 28 | " 'D': set(['B']),\n", 29 | " 'E': set(['B', 'F']),\n", 30 | " 'F': set(['C', 'E'])}" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "# Good Luck!" 38 | ] 39 | } 40 | ], 41 | "metadata": { 42 | "kernelspec": { 43 | "display_name": "Python 3", 44 | "language": "python", 45 | "name": "python3" 46 | }, 47 | "language_info": { 48 | "codemirror_mode": { 49 | "name": "ipython", 50 | "version": 3 51 | }, 52 | "file_extension": ".py", 53 | "mimetype": "text/x-python", 54 | "name": "python", 55 | "nbconvert_exporter": "python", 56 | "pygments_lexer": "ipython3", 57 | "version": "3.8.10" 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 1 62 | } 63 | -------------------------------------------------------------------------------- /08-Graphs/Graph Interview Questions/01-Implement a Graph.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Graph Class!\n", 8 | "\n", 9 | "That's it! \n", 10 | "\n", 11 | "Best of luck and reference the video lecture for any questions!\n", 12 | "\n", 13 | "You have to fully worked out implementations in the lectures, so make sure to refer to them!" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "# Good Luck!" 21 | ] 22 | } 23 | ], 24 | "metadata": { 25 | "kernelspec": { 26 | "display_name": "Python 3", 27 | "language": "python", 28 | "name": "python3" 29 | }, 30 | "language_info": { 31 | "codemirror_mode": { 32 | "name": "ipython", 33 | "version": 3 34 | }, 35 | "file_extension": ".py", 36 | "mimetype": "text/x-python", 37 | "name": "python", 38 | "nbconvert_exporter": "python", 39 | "pygments_lexer": "ipython3", 40 | "version": "3.8.10" 41 | } 42 | }, 43 | "nbformat": 4, 44 | "nbformat_minor": 1 45 | } 46 | -------------------------------------------------------------------------------- /08-Graphs/Graph Interview Questions/02-Implement Depth First Search Algorithm.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Depth First Search Algorithm" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "For this problem, implement a DFS Algorithm! You can assume that the graph is in the simplified form:" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 8, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "graph = {'A': set(['B', 'C']),\n", 26 | " 'B': set(['A', 'D', 'E']),\n", 27 | " 'C': set(['A', 'F']),\n", 28 | " 'D': set(['B']),\n", 29 | " 'E': set(['B', 'F']),\n", 30 | " 'F': set(['C', 'E'])}" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "# Good Luck!" 38 | ] 39 | } 40 | ], 41 | "metadata": { 42 | "kernelspec": { 43 | "display_name": "Python 3", 44 | "language": "python", 45 | "name": "python3" 46 | }, 47 | "language_info": { 48 | "codemirror_mode": { 49 | "name": "ipython", 50 | "version": 3 51 | }, 52 | "file_extension": ".py", 53 | "mimetype": "text/x-python", 54 | "name": "python", 55 | "nbconvert_exporter": "python", 56 | "pygments_lexer": "ipython3", 57 | "version": "3.8.10" 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 1 62 | } 63 | -------------------------------------------------------------------------------- /08-Graphs/Graph Interview Questions/03-Implement Breadth First Search Algorithm.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Breadth First Search Algorithm" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "For this problem, implement a BFS Algorithm! You can assume that the graph is in the simplified form:" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 8, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "graph = {'A': set(['B', 'C']),\n", 26 | " 'B': set(['A', 'D', 'E']),\n", 27 | " 'C': set(['A', 'F']),\n", 28 | " 'D': set(['B']),\n", 29 | " 'E': set(['B', 'F']),\n", 30 | " 'F': set(['C', 'E'])}" 31 | ] 32 | }, 33 | { 34 | "cell_type": "markdown", 35 | "metadata": {}, 36 | "source": [ 37 | "# Good Luck!" 38 | ] 39 | } 40 | ], 41 | "metadata": { 42 | "kernelspec": { 43 | "display_name": "Python 3", 44 | "language": "python", 45 | "name": "python3" 46 | }, 47 | "language_info": { 48 | "codemirror_mode": { 49 | "name": "ipython", 50 | "version": 3 51 | }, 52 | "file_extension": ".py", 53 | "mimetype": "text/x-python", 54 | "name": "python", 55 | "nbconvert_exporter": "python", 56 | "pygments_lexer": "ipython3", 57 | "version": "3.8.10" 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 1 62 | } 63 | -------------------------------------------------------------------------------- /08-Graphs/words.txt: -------------------------------------------------------------------------------- 1 | pope 2 | rope 3 | sage 4 | best 5 | ripe 6 | pipe -------------------------------------------------------------------------------- /09-Riddles/.ipynb_checkpoints/01-How to Approach Riddles-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# How to Approach Riddles\n", 8 | "\n", 9 | "Please view the video lecture for full explanation on this topic!" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.10" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 1 34 | } 35 | -------------------------------------------------------------------------------- /09-Riddles/01-How to Approach Riddles.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# How to Approach Riddles\n", 8 | "\n", 9 | "Please view the video lecture for full explanation on this topic!" 10 | ] 11 | } 12 | ], 13 | "metadata": { 14 | "kernelspec": { 15 | "display_name": "Python 3", 16 | "language": "python", 17 | "name": "python3" 18 | }, 19 | "language_info": { 20 | "codemirror_mode": { 21 | "name": "ipython", 22 | "version": 3 23 | }, 24 | "file_extension": ".py", 25 | "mimetype": "text/x-python", 26 | "name": "python", 27 | "nbconvert_exporter": "python", 28 | "pygments_lexer": "ipython3", 29 | "version": "3.8.10" 30 | } 31 | }, 32 | "nbformat": 4, 33 | "nbformat_minor": 1 34 | } 35 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/01-Bridge-Crossing/01-Bridge Crossing - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Bridge Crossing - SOLUTION" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Problem Statement\n", 15 | "\n", 16 | "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", 17 | "\n", 18 | "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", 19 | "\n", 20 | "What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?\n", 21 | "\n", 22 | "## Solution\n", 23 | "\n", 24 | "This is part of a common group of [river crossing](https://en.wikipedia.org/wiki/River_crossing_puzzle) puzzles. Its know as the [Bridge and Torch problem](https://en.wikipedia.org/wiki/Bridge_and_torch_problem) (sometimes the times assigned to each person are different).\n", 25 | "\n", 26 | "The solution to this version is:\n", 27 | "\n", 28 | "\n", 29 | "\n", 30 | "\n", 31 | "\n", 32 | "\n", 33 | "\n", 34 | "\n", 35 | "\n", 36 | "\n", 37 | "\n", 38 | "\n", 39 | "\n", 40 | "\n", 41 | "
MoveTime
(1) & (2) Cross with Torch2
(1) Returns with Torch1
(5) & (10) Cross with Torch10
(2) Returns with Torch2
(1) & (2) Cross with Torch2
 17
" 42 | ] 43 | } 44 | ], 45 | "metadata": { 46 | "kernelspec": { 47 | "display_name": "Python 3", 48 | "language": "python", 49 | "name": "python3" 50 | }, 51 | "language_info": { 52 | "codemirror_mode": { 53 | "name": "ipython", 54 | "version": 3 55 | }, 56 | "file_extension": ".py", 57 | "mimetype": "text/x-python", 58 | "name": "python", 59 | "nbconvert_exporter": "python", 60 | "pygments_lexer": "ipython3", 61 | "version": "3.8.10" 62 | } 63 | }, 64 | "nbformat": 4, 65 | "nbformat_minor": 1 66 | } 67 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/01-Bridge-Crossing/01-Bridge Crossing.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Bridge Crossing" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Problem Statement\n", 15 | "\n", 16 | "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", 17 | "\n", 18 | "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", 19 | "\n", 20 | "What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?\n", 21 | "\n" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.8.10" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 1 46 | } 47 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/02-Coins-and-a-Scale/02-Coins and a Scale - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Coins and a Scale - SOLUTION\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?\n", 11 | "\n", 12 | "## Solution\n", 13 | "\n", 14 | "Begin by dividing the coins into two groups of three, which you put on the scale, and one group of two, which you leave off. If the two sides weigh the same, the heavy coin is in the group of two, and you can find it with one more weighing, for a total of two weighings. On the other hand, if either side of the scale is heavier, the heavy coin must be in that group of three. You can eliminate all the other coins, and place one coin from this group on either side of the scale, leaving the third coin aside. If one side is heavier, it contains the heavy coin; if neither side is heavier, the heavy coin is the one you didn’t place on the scale. This is also a total of two weighings, so you can always find the heavy coin in a group of eight using two weighings." 15 | ] 16 | } 17 | ], 18 | "metadata": { 19 | "kernelspec": { 20 | "display_name": "Python 3", 21 | "language": "python", 22 | "name": "python3" 23 | }, 24 | "language_info": { 25 | "codemirror_mode": { 26 | "name": "ipython", 27 | "version": 3 28 | }, 29 | "file_extension": ".py", 30 | "mimetype": "text/x-python", 31 | "name": "python", 32 | "nbconvert_exporter": "python", 33 | "pygments_lexer": "ipython3", 34 | "version": "3.8.10" 35 | } 36 | }, 37 | "nbformat": 4, 38 | "nbformat_minor": 1 39 | } 40 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/02-Coins-and-a-Scale/02-Coins and a Scale .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Coins and a Scale \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.10" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 1 35 | } 36 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/03-Egg-Drop/03-Egg Drop .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Egg Drop \n", 8 | "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", 9 | "## Problem Statement\n", 10 | "\n", 11 | "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", 12 | "\n", 13 | "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)" 14 | ] 15 | } 16 | ], 17 | "metadata": { 18 | "kernelspec": { 19 | "display_name": "Python 3", 20 | "language": "python", 21 | "name": "python3" 22 | }, 23 | "language_info": { 24 | "codemirror_mode": { 25 | "name": "ipython", 26 | "version": 3 27 | }, 28 | "file_extension": ".py", 29 | "mimetype": "text/x-python", 30 | "name": "python", 31 | "nbconvert_exporter": "python", 32 | "pygments_lexer": "ipython3", 33 | "version": "3.8.10" 34 | } 35 | }, 36 | "nbformat": 4, 37 | "nbformat_minor": 1 38 | } 39 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/04-Hallway-Lockers/04-Hallway Lockers.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Hallway Lockers\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.10" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 1 35 | } 36 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/05-Jugs-of-Water/05-Jugs of Water .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Jugs of Water \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.10" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 1 35 | } 36 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/06-Light-Switches/06-Light Switches - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Light Switches - SOLUTION\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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", 11 | "\n", 12 | "**Note: This is a \"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", 13 | "\n", 14 | "## Solution\n", 15 | "\n", 16 | "This is a bit of a trick question and hopefully you don't get asked this type of question in an interview, since its not really math or logic based. The solution is to realize that you can leave an *incandescent* light bulb on for awhile until it heats up. \n", 17 | "\n", 18 | "So the solution is to turn on switch 1 and wait for 15 minutes until that corrresponding bulb is hot. Then turn it off and turn on switch 2 then head to the room. Then you know that:\n", 19 | "\n", 20 | "* The bulb which is hot corresponds to switch 1\n", 21 | "* The bulb which is on corresponds to switch 2\n", 22 | "* The bulb which is off corresponds to switch 3" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 3", 29 | "language": "python", 30 | "name": "python3" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 3 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython3", 42 | "version": "3.8.10" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 1 47 | } 48 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/06-Light-Switches/06-Light Switches .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Light Switches\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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", 11 | "\n", 12 | "**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" 13 | ] 14 | } 15 | ], 16 | "metadata": { 17 | "kernelspec": { 18 | "display_name": "Python 3", 19 | "language": "python", 20 | "name": "python3" 21 | }, 22 | "language_info": { 23 | "codemirror_mode": { 24 | "name": "ipython", 25 | "version": 3 26 | }, 27 | "file_extension": ".py", 28 | "mimetype": "text/x-python", 29 | "name": "python", 30 | "nbconvert_exporter": "python", 31 | "pygments_lexer": "ipython3", 32 | "version": "3.8.10" 33 | } 34 | }, 35 | "nbformat": 4, 36 | "nbformat_minor": 1 37 | } 38 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/07-Ropes-Burning/07-Ropes Burning - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ropes Burning - SOLUTION\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "You have two ropes. Each takes exactly 60 minutes to burn.\n", 11 | "\n", 12 | "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", 13 | "\n", 14 | "How do you measure out exactly 45 minutes?\n", 15 | "\n", 16 | "## Solution\n", 17 | "\n", 18 | "Take one rope and burn it at both ends.\n", 19 | "\n", 20 | "At the same time, burn one end of the other rope.\n", 21 | "\n", 22 | "When the first rope finishes burning, light the other end of the remaining rope.\n", 23 | "\n", 24 | "When it burns out, that's 45 minutes." 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 3", 31 | "language": "python", 32 | "name": "python3" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 3 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython3", 44 | "version": "3.8.10" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 1 49 | } 50 | -------------------------------------------------------------------------------- /09-Riddles/Riddle Interview Problems/07-Ropes-Burning/07-Ropes Burning.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ropes Burning \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "You have two ropes. Each takes exactly 60 minutes to burn.\n", 11 | "\n", 12 | "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", 13 | "\n", 14 | "How do you measure out exactly 45 minutes?" 15 | ] 16 | } 17 | ], 18 | "metadata": { 19 | "kernelspec": { 20 | "display_name": "Python 3", 21 | "language": "python", 22 | "name": "python3" 23 | }, 24 | "language_info": { 25 | "codemirror_mode": { 26 | "name": "ipython", 27 | "version": 3 28 | }, 29 | "file_extension": ".py", 30 | "mimetype": "text/x-python", 31 | "name": "python", 32 | "nbconvert_exporter": "python", 33 | "pygments_lexer": "ipython3", 34 | "version": "3.8.10" 35 | } 36 | }, 37 | "nbformat": 4, 38 | "nbformat_minor": 1 39 | } 40 | -------------------------------------------------------------------------------- /10-Mock Interviews/01-Large E-Commerce Company/01-On-Site-Question-1/01-On-Site Question 1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** You've been given a list of historical stock prices for a single day for Amazon stock. The index of the list represents the timestamp, so the element at index of 0 is the initial price of the stock, the element at index 1 is the next recorded price of the stock for that day, etc. Your task is to write a function that will return the maximum profit possible from the purchase and sale of a single share of Amazon stock on that day. Keep in mind to try to make this as efficient as possible.**\n", 12 | "\n", 13 | "\n", 14 | "For example, if you were given the list of stock prices:\n", 15 | "\n", 16 | "prices = [12,11,15,3,10]\n", 17 | "\n", 18 | "Then your function would return the maximum possible profit, which would be 7 (buying at 3 and selling at 10).\n", 19 | "\n", 20 | "## Requirements\n", 21 | "\n", 22 | "** Try to solve this problem with paper/pencil first without using an IDE. Also keep in mind you should be able to come up with a better solution than just brute forcing every possible sale combination **\n", 23 | "\n", 24 | "** Also you can't \"short\" a stock, you must buy *before* you sell the stock. **" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "# Good Luck!" 32 | ] 33 | } 34 | ], 35 | "metadata": { 36 | "kernelspec": { 37 | "display_name": "Python 3", 38 | "language": "python", 39 | "name": "python3" 40 | }, 41 | "language_info": { 42 | "codemirror_mode": { 43 | "name": "ipython", 44 | "version": 3 45 | }, 46 | "file_extension": ".py", 47 | "mimetype": "text/x-python", 48 | "name": "python", 49 | "nbconvert_exporter": "python", 50 | "pygments_lexer": "ipython3", 51 | "version": "3.8.10" 52 | } 53 | }, 54 | "nbformat": 4, 55 | "nbformat_minor": 1 56 | } 57 | -------------------------------------------------------------------------------- /10-Mock Interviews/01-Large E-Commerce Company/02-On-Site-Question-2/02-On-Site Question 2 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a list of integers, write a function that will return a list, in which for each index the element will be the product of all the integers except for the element at that index **\n", 12 | "\n", 13 | "**For example, an input of [1,2,3,4] would return [24,12,8,6] by performing [2×3×4,1×3×4,1×2×4,1×2×3] **\n", 14 | "\n", 15 | "## Requirements\n", 16 | "\n", 17 | "** You can not use division in your answer! Meaning you can't simply multiply all the numbers and then divide by eahc element for each index!**\n", 18 | "\n", 19 | "** Try to do this on a white board or with paper/pencil.**" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "# Good Luck!" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 3", 33 | "language": "python", 34 | "name": "python3" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 3 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython3", 46 | "version": "3.8.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 1 51 | } 52 | -------------------------------------------------------------------------------- /10-Mock Interviews/01-Large E-Commerce Company/03-On-Site-Question-3/03-On-Site Question 3.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3\n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "**Given two rectangles, determine if they overlap. The rectangles are defined as a Dictionary, for example:**" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "r1 = {\n", 21 | " \n", 22 | " # x and y coordinates of the bottom-left corner of the rectangle\n", 23 | " 'x': 2 , 'y': 4,\n", 24 | " \n", 25 | " # Width and Height of rectangle\n", 26 | " 'w':5,'h':12}" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "** If the rectangles do overlap, return the dictionary which describes the overlapping section**" 34 | ] 35 | }, 36 | { 37 | "cell_type": "markdown", 38 | "metadata": {}, 39 | "source": [ 40 | "## Requirements\n", 41 | "\n", 42 | "** Make sure the dictionary you output is in the same form as the input.**\n", 43 | "\n", 44 | "** Feel free to use an IDE for the code, but make sure you use paper/pencil or whiteboard to draw out your plan and logic**" 45 | ] 46 | }, 47 | { 48 | "cell_type": "markdown", 49 | "metadata": {}, 50 | "source": [ 51 | "# Good Luck!" 52 | ] 53 | } 54 | ], 55 | "metadata": { 56 | "kernelspec": { 57 | "display_name": "Python 3", 58 | "language": "python", 59 | "name": "python3" 60 | }, 61 | "language_info": { 62 | "codemirror_mode": { 63 | "name": "ipython", 64 | "version": 3 65 | }, 66 | "file_extension": ".py", 67 | "mimetype": "text/x-python", 68 | "name": "python", 69 | "nbconvert_exporter": "python", 70 | "pygments_lexer": "ipython3", 71 | "version": "3.8.10" 72 | } 73 | }, 74 | "nbformat": 4, 75 | "nbformat_minor": 1 76 | } 77 | -------------------------------------------------------------------------------- /10-Mock Interviews/01-Large E-Commerce Company/04-Phone-Screen/04-Phone Screen .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "**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", 12 | "\n", 13 | "**Show algorithmically how you would go about doing this in as few drops as possible**\n", 14 | "\n", 15 | "## Requirements\n", 16 | "\n", 17 | "** Use paper/pencil or a whiteboard for this problem **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 3", 31 | "language": "python", 32 | "name": "python3" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 3 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython3", 44 | "version": "3.8.10" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 1 49 | } 50 | -------------------------------------------------------------------------------- /10-Mock Interviews/02-Large Search Engine Company /01-On-Site-Question-1/01-On-Site Question 1 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "___\n", 9 | "\n", 10 | "## Question\n", 11 | "** Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** 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! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "___" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 3", 36 | "language": "python", 37 | "name": "python3" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 1 54 | } 55 | -------------------------------------------------------------------------------- /10-Mock Interviews/02-Large Search Engine Company /02-On-Site-Question-2/02-On-Site Question 2 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "___\n", 9 | "\n", 10 | "## Question\n", 11 | "** Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice! **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** 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! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "___" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 3", 36 | "language": "python", 37 | "name": "python3" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 3 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython3", 49 | "version": "3.8.10" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 1 54 | } 55 | -------------------------------------------------------------------------------- /10-Mock Interviews/02-Large Search Engine Company /03-On-Site-Question-3/03-On-Site Question 3 -SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 - SOLUTION\n", 8 | "\n", 9 | "## Question\n", 10 | "\n", 11 | "**Given a string, write a function that uses recursion to reverse it. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "____" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# SOLUTION\n", 30 | "\n", 31 | "Hopefully you remember this problem, you've already seen it! The solution is:" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 1, 37 | "metadata": {}, 38 | "outputs": [], 39 | "source": [ 40 | "def reverse(s):\n", 41 | " \n", 42 | " # Base Case\n", 43 | " if len(s) <= 1:\n", 44 | " return s\n", 45 | "\n", 46 | " # Recursion\n", 47 | " return reverse(s[1:]) + s[0]" 48 | ] 49 | }, 50 | { 51 | "cell_type": "markdown", 52 | "metadata": {}, 53 | "source": [ 54 | "___\n", 55 | "## Notes\n", 56 | "\n", 57 | "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." 58 | ] 59 | }, 60 | { 61 | "cell_type": "markdown", 62 | "metadata": {}, 63 | "source": [ 64 | "# Good Job!" 65 | ] 66 | } 67 | ], 68 | "metadata": { 69 | "kernelspec": { 70 | "display_name": "Python 3", 71 | "language": "python", 72 | "name": "python3" 73 | }, 74 | "language_info": { 75 | "codemirror_mode": { 76 | "name": "ipython", 77 | "version": 3 78 | }, 79 | "file_extension": ".py", 80 | "mimetype": "text/x-python", 81 | "name": "python", 82 | "nbconvert_exporter": "python", 83 | "pygments_lexer": "ipython3", 84 | "version": "3.8.10" 85 | } 86 | }, 87 | "nbformat": 4, 88 | "nbformat_minor": 1 89 | } 90 | -------------------------------------------------------------------------------- /10-Mock Interviews/02-Large Search Engine Company /03-On-Site-Question-3/03-On-Site Question 3 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Question\n", 10 | "\n", 11 | "**Given a string, write a function that uses recursion to reverse it. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "____" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 3", 36 | "language": "python", 37 | "name": "python3" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 3 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython3", 49 | "version": "3.8.10" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 1 54 | } 55 | -------------------------------------------------------------------------------- /10-Mock Interviews/02-Large Search Engine Company /04-On-Site-Question-4/04-On-Site Question 4 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 4 \n", 8 | "\n", 9 | "## Question\n", 10 | "**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", 11 | "\n", 12 | "## Requirements\n", 13 | "\n", 14 | "** Feel free to code this out (but its recommended that you use paper/pencil or whiteboard)**" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "# Good Luck!" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.8.10" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 1 46 | } 47 | -------------------------------------------------------------------------------- /10-Mock Interviews/02-Large Search Engine Company /05-Phone-Screen/05-Phone Screen.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen\n", 8 | "\n", 9 | "**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", 10 | "___\n", 11 | "## Non-Technical Questions\n", 12 | "\n", 13 | "**Answer the following questions (2-5 minute responses) technical answers not required, more interested in hearing about your reasoning**" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "* Give me some quick background about you (go over your resume)\n", 21 | "* Why do you want to work here?\n", 22 | "* What's your favorite programming language and why?\n", 23 | "* Where do you see yourself in 5 years?\n", 24 | "* Do you have any questions about the company for me?" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "___" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "___\n", 39 | "## Technical Questions\n", 40 | "\n", 41 | "**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", 42 | "\n", 43 | "1. Write a function that computes the Nth fibonacci number" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "metadata": {}, 49 | "source": [] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "# Good Job!" 56 | ] 57 | } 58 | ], 59 | "metadata": { 60 | "kernelspec": { 61 | "display_name": "Python 3", 62 | "language": "python", 63 | "name": "python3" 64 | }, 65 | "language_info": { 66 | "codemirror_mode": { 67 | "name": "ipython", 68 | "version": 3 69 | }, 70 | "file_extension": ".py", 71 | "mimetype": "text/x-python", 72 | "name": "python", 73 | "nbconvert_exporter": "python", 74 | "pygments_lexer": "ipython3", 75 | "version": "3.8.10" 76 | } 77 | }, 78 | "nbformat": 4, 79 | "nbformat_minor": 1 80 | } 81 | -------------------------------------------------------------------------------- /10-Mock Interviews/03-Ride Share Start-Up Company/01-On-Site-Quesion-1/On-Site Question 1 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a list of integers, find the largest product you could make from 3 integers in the list **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You can assume that the list will always have at least 3 integers **\n", 16 | "\n", 17 | "** Paper/pencil only, don't code this out until you've solved it as far as you can by hand. **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 2", 31 | "language": "python", 32 | "name": "python2" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 2 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython2", 44 | "version": "2.7.11" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 0 49 | } 50 | -------------------------------------------------------------------------------- /10-Mock Interviews/03-Ride Share Start-Up Company/02-On-Site-Quesion-2/On-Site Question 2 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Write out your work on paper/pencil, then see if you can code up your solution **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /10-Mock Interviews/03-Ride Share Start-Up Company/03-On-Site-Quesion-3/On-Site Question 3 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a binary tree, check whether it’s a binary search tree or not. **" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": {}, 17 | "source": [ 18 | "## Requirements\n", 19 | "\n", 20 | "** Use paper/pencil, do not code this in an IDE until you've done it manually**\n", 21 | "\n", 22 | "** Do not use built-in Python libraries to do this, but do mention them if you know about them **" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /10-Mock Interviews/03-Ride Share Start-Up Company/04-Phone-Screen/Phone Screen - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen - SOLUTION\n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try explaining your solution to someone and see if it makes sense ot them. Don't code anything for this problem **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "## Solution\n", 23 | "\n", 24 | "Hopefully this problem sounds familiar! We can use a binary search to search for an intger since the list is already sorted! This means we can find the item in [O(logn) time and O(1) space](http://bigocheatsheet.com/)!\n", 25 | "\n", 26 | "Revisit the lectures on Binary Search and its implementation to fully get the reasoning behind this solution and problem!\n", 27 | "\n", 28 | "# Good Job!" 29 | ] 30 | } 31 | ], 32 | "metadata": { 33 | "kernelspec": { 34 | "display_name": "Python 2", 35 | "language": "python", 36 | "name": "python2" 37 | }, 38 | "language_info": { 39 | "codemirror_mode": { 40 | "name": "ipython", 41 | "version": 2 42 | }, 43 | "file_extension": ".py", 44 | "mimetype": "text/x-python", 45 | "name": "python", 46 | "nbconvert_exporter": "python", 47 | "pygments_lexer": "ipython2", 48 | "version": "2.7.11" 49 | } 50 | }, 51 | "nbformat": 4, 52 | "nbformat_minor": 0 53 | } 54 | -------------------------------------------------------------------------------- /10-Mock Interviews/03-Ride Share Start-Up Company/04-Phone-Screen/Phone Screen .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try explaining your solution to someone and see if it makes sense ot them. Don't code anything for this problem **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /10-Mock Interviews/04-Social Network Company/01-On-Site-Question-1/On-Site Question 1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try pen/paper before coding out your solution **\n", 16 | "\n", 17 | "** You can not use an integer element twice. Optimize for time over space **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 2", 31 | "language": "python", 32 | "name": "python2" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 2 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython2", 44 | "version": "2.7.11" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 0 49 | } 50 | -------------------------------------------------------------------------------- /10-Mock Interviews/04-Social Network Company/02-On-Site-Question-2/On-Site Question 2 - SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 - SOLUTION\n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Do not use built-in Python functions or methods **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "source": [ 24 | "## Solution\n", 25 | "\n", 26 | "This should feel very familiar to one of the problems we did in the array section of the course! We can use an [XOR](https://en.wikipedia.org/wiki/Exclusive_or) operation. The **exclusive or** operations will take two sets of bits and for each pair it will return a 1 value if **one but not both** of the bits is 1.\n", 27 | "\n", 28 | "In Python we can use the ^ symbol to perform an XOR.\n", 29 | "\n", 30 | "Now for our solution we can simply XOR all the integers in the list. We start with a unique id set to 0, then every time we XOR a new id from the list, it will change the bits. When we XOR with the same ID again, it will cancel out the earlier change.\n", 31 | "\n", 32 | "By the end, we wil be left with the ID that was unique and only appeared once!" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": 2, 38 | "metadata": { 39 | "collapsed": true 40 | }, 41 | "outputs": [], 42 | "source": [ 43 | "def solution(id_list):\n", 44 | " \n", 45 | " # Initiate unique Id\n", 46 | " unique_id = 0\n", 47 | " \n", 48 | " # XOR fo revery id in id list\n", 49 | " for i in id_list:\n", 50 | " \n", 51 | " # XOR operation\n", 52 | " unique_id ^= i\n", 53 | " \n", 54 | " return unique_id" 55 | ] 56 | }, 57 | { 58 | "cell_type": "markdown", 59 | "metadata": {}, 60 | "source": [ 61 | "# Good Job!" 62 | ] 63 | } 64 | ], 65 | "metadata": { 66 | "kernelspec": { 67 | "display_name": "Python 2", 68 | "language": "python", 69 | "name": "python2" 70 | }, 71 | "language_info": { 72 | "codemirror_mode": { 73 | "name": "ipython", 74 | "version": 2 75 | }, 76 | "file_extension": ".py", 77 | "mimetype": "text/x-python", 78 | "name": "python", 79 | "nbconvert_exporter": "python", 80 | "pygments_lexer": "ipython2", 81 | "version": "2.7.11" 82 | } 83 | }, 84 | "nbformat": 4, 85 | "nbformat_minor": 0 86 | } 87 | -------------------------------------------------------------------------------- /10-Mock Interviews/04-Social Network Company/02-On-Site-Question-2/On-Site Question 2.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Do not use built-in Python functions or methods **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /10-Mock Interviews/04-Social Network Company/03-On-Site-Question-3/On-Site Question 3.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Your function should be able to perform this in less than O(nlogn) time. **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /10-Mock Interviews/04-Social Network Company/04-Phone-Screen/Phone Screen .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem \n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "**Complete this problem on a text editor that does not have syntax highlighting, such as a goolge doc!**" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Linked Lists/Linked Lists Interview Problems/Linked List Interview Problems/.ipynb_checkpoints/Implement a Doubly Linked List-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Doubly Linked List\n", 8 | "\n", 9 | "For this interview problem, implement a node class and show how it can be used to create a doubly linked list." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": true 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "class Node(object):\n", 21 | " pass" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 2, 27 | "metadata": { 28 | "collapsed": true 29 | }, 30 | "outputs": [], 31 | "source": [ 32 | "# Create a Doubly Linked List here" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "# Test Your Solution\n", 40 | "Note that there is no test for this solution (because it would give away the answer structure).\n", 41 | "\n", 42 | "Check out the Implement a Linked List Solution Notebook for the answer to this interview problem, as well as the answer for the implementation of a singly linked list." 43 | ] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 2", 49 | "language": "python", 50 | "name": "python2" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 2 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython2", 62 | "version": "2.7.11" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 0 67 | } 68 | -------------------------------------------------------------------------------- /Linked Lists/Linked Lists Interview Problems/Linked List Interview Problems/.ipynb_checkpoints/Implement a Singly Linked List-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Singly Linked List\n", 8 | "\n", 9 | "For this interview problem, create a node class and show how it can be used to create a Singly Linked List" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": true 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "class Node(object):\n", 21 | " pass" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": { 28 | "collapsed": true 29 | }, 30 | "outputs": [], 31 | "source": [ 32 | "# Create a Singly Linked List here" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "# Test Your Solution\n", 40 | "\n", 41 | "Note that there is no test for this solution (because it would give away the answer structure).\n", 42 | "\n", 43 | "Check out the Implement a Linked List Solution Notebook for the answer to this interview problem, as well as the answer for the implementation of a doubly linked list." 44 | ] 45 | } 46 | ], 47 | "metadata": { 48 | "kernelspec": { 49 | "display_name": "Python 2", 50 | "language": "python", 51 | "name": "python2" 52 | }, 53 | "language_info": { 54 | "codemirror_mode": { 55 | "name": "ipython", 56 | "version": 2 57 | }, 58 | "file_extension": ".py", 59 | "mimetype": "text/x-python", 60 | "name": "python", 61 | "nbconvert_exporter": "python", 62 | "pygments_lexer": "ipython2", 63 | "version": "2.7.11" 64 | } 65 | }, 66 | "nbformat": 4, 67 | "nbformat_minor": 0 68 | } 69 | -------------------------------------------------------------------------------- /Linked Lists/Linked Lists Interview Problems/Linked List Interview Problems/Implement a Doubly Linked List.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Doubly Linked List\n", 8 | "\n", 9 | "For this interview problem, implement a node class and show how it can be used to create a doubly linked list." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": true 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "class Node(object):\n", 21 | " pass" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": 2, 27 | "metadata": { 28 | "collapsed": true 29 | }, 30 | "outputs": [], 31 | "source": [ 32 | "# Create a Doubly Linked List here" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "# Test Your Solution\n", 40 | "Note that there is no test for this solution (because it would give away the answer structure).\n", 41 | "\n", 42 | "Check out the Implement a Linked List Solution Notebook for the answer to this interview problem, as well as the answer for the implementation of a singly linked list." 43 | ] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 2", 49 | "language": "python", 50 | "name": "python2" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 2 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython2", 62 | "version": "2.7.11" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 0 67 | } 68 | -------------------------------------------------------------------------------- /Linked Lists/Linked Lists Interview Problems/Linked List Interview Problems/Implement a Singly Linked List.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Singly Linked List\n", 8 | "\n", 9 | "For this interview problem, create a node class and show how it can be used to create a Singly Linked List" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "collapsed": true 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "class Node(object):\n", 21 | " pass" 22 | ] 23 | }, 24 | { 25 | "cell_type": "code", 26 | "execution_count": null, 27 | "metadata": { 28 | "collapsed": true 29 | }, 30 | "outputs": [], 31 | "source": [ 32 | "# Create a Singly Linked List here" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": {}, 38 | "source": [ 39 | "# Test Your Solution\n", 40 | "\n", 41 | "Note that there is no test for this solution (because it would give away the answer structure).\n", 42 | "\n", 43 | "Check out the Implement a Linked List Solution Notebook for the answer to this interview problem, as well as the answer for the implementation of a doubly linked list." 44 | ] 45 | } 46 | ], 47 | "metadata": { 48 | "kernelspec": { 49 | "display_name": "Python 2", 50 | "language": "python", 51 | "name": "python2" 52 | }, 53 | "language_info": { 54 | "codemirror_mode": { 55 | "name": "ipython", 56 | "version": 2 57 | }, 58 | "file_extension": ".py", 59 | "mimetype": "text/x-python", 60 | "name": "python", 61 | "nbconvert_exporter": "python", 62 | "pygments_lexer": "ipython2", 63 | "version": "2.7.11" 64 | } 65 | }, 66 | "nbformat": 4, 67 | "nbformat_minor": 0 68 | } 69 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/.ipynb_checkpoints/On-Site Question 3 -SOLUTION-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 - SOLUTION\n", 8 | "\n", 9 | "## Question\n", 10 | "\n", 11 | "**Given a string, write a function that uses recursion to reverse it. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "____" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# SOLUTION\n", 30 | "\n", 31 | "Hopefully you remember this problem, you've already seen it! The solution is:" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 1, 37 | "metadata": { 38 | "collapsed": true 39 | }, 40 | "outputs": [], 41 | "source": [ 42 | "def reverse(s):\n", 43 | " \n", 44 | " # Base Case\n", 45 | " if len(s) <= 1:\n", 46 | " return s\n", 47 | "\n", 48 | " # Recursion\n", 49 | " return reverse(s[1:]) + s[0]" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "___\n", 57 | "## Notes\n", 58 | "\n", 59 | "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." 60 | ] 61 | }, 62 | { 63 | "cell_type": "markdown", 64 | "metadata": {}, 65 | "source": [ 66 | "# Good Job!" 67 | ] 68 | } 69 | ], 70 | "metadata": { 71 | "kernelspec": { 72 | "display_name": "Python 2", 73 | "language": "python", 74 | "name": "python2" 75 | }, 76 | "language_info": { 77 | "codemirror_mode": { 78 | "name": "ipython", 79 | "version": 2 80 | }, 81 | "file_extension": ".py", 82 | "mimetype": "text/x-python", 83 | "name": "python", 84 | "nbconvert_exporter": "python", 85 | "pygments_lexer": "ipython2", 86 | "version": "2.7.11" 87 | } 88 | }, 89 | "nbformat": 4, 90 | "nbformat_minor": 0 91 | } 92 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems - SOLUTIONS/On-Site Question 3 -SOLUTION.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 - SOLUTION\n", 8 | "\n", 9 | "## Question\n", 10 | "\n", 11 | "**Given a string, write a function that uses recursion to reverse it. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "____" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# SOLUTION\n", 30 | "\n", 31 | "Hopefully you remember this problem, you've already seen it! The solution is:" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": 1, 37 | "metadata": { 38 | "collapsed": true 39 | }, 40 | "outputs": [], 41 | "source": [ 42 | "def reverse(s):\n", 43 | " \n", 44 | " # Base Case\n", 45 | " if len(s) <= 1:\n", 46 | " return s\n", 47 | "\n", 48 | " # Recursion\n", 49 | " return reverse(s[1:]) + s[0]" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "___\n", 57 | "## Notes\n", 58 | "\n", 59 | "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." 60 | ] 61 | }, 62 | { 63 | "cell_type": "markdown", 64 | "metadata": {}, 65 | "source": [ 66 | "# Good Job!" 67 | ] 68 | } 69 | ], 70 | "metadata": { 71 | "kernelspec": { 72 | "display_name": "Python 2", 73 | "language": "python", 74 | "name": "python2" 75 | }, 76 | "language_info": { 77 | "codemirror_mode": { 78 | "name": "ipython", 79 | "version": 2 80 | }, 81 | "file_extension": ".py", 82 | "mimetype": "text/x-python", 83 | "name": "python", 84 | "nbconvert_exporter": "python", 85 | "pygments_lexer": "ipython2", 86 | "version": "2.7.11" 87 | } 88 | }, 89 | "nbformat": 4, 90 | "nbformat_minor": 0 91 | } 92 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "___\n", 9 | "\n", 10 | "## Question\n", 11 | "** Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** 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! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "___" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "___\n", 9 | "\n", 10 | "## Question\n", 11 | "** Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice! **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** 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! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "___" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Question\n", 10 | "\n", 11 | "**Given a string, write a function that uses recursion to reverse it. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "____" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/On-Site Question 4 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 4 \n", 8 | "\n", 9 | "## Question\n", 10 | "**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", 11 | "\n", 12 | "## Requirements\n", 13 | "\n", 14 | "** Feel free to code this out (but its recommended that you use paper/pencil or whiteboard)**" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "# Good Luck!" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 2", 28 | "language": "python", 29 | "name": "python2" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 2 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython2", 41 | "version": "2.7.11" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 0 46 | } 47 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/.ipynb_checkpoints/Phone Screen-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen\n", 8 | "\n", 9 | "**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", 10 | "___\n", 11 | "## Non-Technical Questions\n", 12 | "\n", 13 | "**Answer the following questions (2-5 minute responses) technical answers not required, more interested in hearing about your reasoning**" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "* Give me some quick background about you (go over your resume)\n", 21 | "* Why do you want to work here?\n", 22 | "* What's your favorite programming language and why?\n", 23 | "* Where do you see yourself in 5 years?\n", 24 | "* Do you have any questions about the company for me?" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "___" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "___\n", 39 | "## Technical Questions\n", 40 | "\n", 41 | "**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", 42 | "\n", 43 | "1. Write a function that computes the Nth fibonacci number" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "metadata": {}, 49 | "source": [] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "# Good Job!" 56 | ] 57 | } 58 | ], 59 | "metadata": { 60 | "kernelspec": { 61 | "display_name": "Python 2", 62 | "language": "python", 63 | "name": "python2" 64 | }, 65 | "language_info": { 66 | "codemirror_mode": { 67 | "name": "ipython", 68 | "version": 2 69 | }, 70 | "file_extension": ".py", 71 | "mimetype": "text/x-python", 72 | "name": "python", 73 | "nbconvert_exporter": "python", 74 | "pygments_lexer": "ipython2", 75 | "version": "2.7.11" 76 | } 77 | }, 78 | "nbformat": 4, 79 | "nbformat_minor": 0 80 | } 81 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 1 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "___\n", 9 | "\n", 10 | "## Question\n", 11 | "** Given a dice which rolls 1 to 7 (with uniform probability), simulate a 5 sided dice. Preferably, write your solution as a function. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** 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! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "___" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 2 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "___\n", 9 | "\n", 10 | "## Question\n", 11 | "** Given a dice which rolls from 1 to 5, simulate a uniform 7 sided dice! **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** 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! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "___" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 3 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Question\n", 10 | "\n", 11 | "**Given a string, write a function that uses recursion to reverse it. **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You MUST use pen and paper or a whiteboard to answer this, no coding allowed! **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "____" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/On-Site Question 4 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 4 \n", 8 | "\n", 9 | "## Question\n", 10 | "**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", 11 | "\n", 12 | "## Requirements\n", 13 | "\n", 14 | "** Feel free to code this out (but its recommended that you use paper/pencil or whiteboard)**" 15 | ] 16 | }, 17 | { 18 | "cell_type": "markdown", 19 | "metadata": {}, 20 | "source": [ 21 | "# Good Luck!" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 2", 28 | "language": "python", 29 | "name": "python2" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 2 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython2", 41 | "version": "2.7.11" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 0 46 | } 47 | -------------------------------------------------------------------------------- /Mock Interviews/Large Search Engine Company/Search Engine Company - Interview Problems/Phone Screen.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen\n", 8 | "\n", 9 | "**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", 10 | "___\n", 11 | "## Non-Technical Questions\n", 12 | "\n", 13 | "**Answer the following questions (2-5 minute responses) technical answers not required, more interested in hearing about your reasoning**" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "* Give me some quick background about you (go over your resume)\n", 21 | "* Why do you want to work here?\n", 22 | "* What's your favorite programming language and why?\n", 23 | "* Where do you see yourself in 5 years?\n", 24 | "* Do you have any questions about the company for me?" 25 | ] 26 | }, 27 | { 28 | "cell_type": "markdown", 29 | "metadata": {}, 30 | "source": [ 31 | "___" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": {}, 37 | "source": [ 38 | "___\n", 39 | "## Technical Questions\n", 40 | "\n", 41 | "**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", 42 | "\n", 43 | "1. Write a function that computes the Nth fibonacci number" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "metadata": {}, 49 | "source": [] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "# Good Job!" 56 | ] 57 | } 58 | ], 59 | "metadata": { 60 | "kernelspec": { 61 | "display_name": "Python 2", 62 | "language": "python", 63 | "name": "python2" 64 | }, 65 | "language_info": { 66 | "codemirror_mode": { 67 | "name": "ipython", 68 | "version": 2 69 | }, 70 | "file_extension": ".py", 71 | "mimetype": "text/x-python", 72 | "name": "python", 73 | "nbconvert_exporter": "python", 74 | "pygments_lexer": "ipython2", 75 | "version": "2.7.11" 76 | } 77 | }, 78 | "nbformat": 4, 79 | "nbformat_minor": 0 80 | } 81 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a list of integers, find the largest product you could make from 3 integers in the list **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You can assume that the list will always have at least 3 integers **\n", 16 | "\n", 17 | "** Paper/pencil only, don't code this out until you've solved it as far as you can by hand. **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 2", 31 | "language": "python", 32 | "name": "python2" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 2 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython2", 44 | "version": "2.7.11" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 0 49 | } 50 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Write out your work on paper/pencil, then see if you can code up your solution **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3 -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a binary tree, check whether it’s a binary search tree or not. **" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": {}, 17 | "source": [ 18 | "## Requirements\n", 19 | "\n", 20 | "** Use paper/pencil, do not code this in an IDE until you've done it manually**\n", 21 | "\n", 22 | "** Do not use built-in Python libraries to do this, but do mention them if you know about them **" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try explaining your solution to someone and see if it makes sense ot them. Don't code anything for this problem **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 1 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a list of integers, find the largest product you could make from 3 integers in the list **\n", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** You can assume that the list will always have at least 3 integers **\n", 16 | "\n", 17 | "** Paper/pencil only, don't code this out until you've solved it as far as you can by hand. **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 2", 31 | "language": "python", 32 | "name": "python2" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 2 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython2", 44 | "version": "2.7.11" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 0 49 | } 50 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 2 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Write out your work on paper/pencil, then see if you can code up your solution **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/On-Site Question 3 .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** Given a binary tree, check whether it’s a binary search tree or not. **" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": {}, 17 | "source": [ 18 | "## Requirements\n", 19 | "\n", 20 | "** Use paper/pencil, do not code this in an IDE until you've done it manually**\n", 21 | "\n", 22 | "** Do not use built-in Python libraries to do this, but do mention them if you know about them **" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": {}, 28 | "source": [ 29 | "# Good Luck!" 30 | ] 31 | } 32 | ], 33 | "metadata": { 34 | "kernelspec": { 35 | "display_name": "Python 2", 36 | "language": "python", 37 | "name": "python2" 38 | }, 39 | "language_info": { 40 | "codemirror_mode": { 41 | "name": "ipython", 42 | "version": 2 43 | }, 44 | "file_extension": ".py", 45 | "mimetype": "text/x-python", 46 | "name": "python", 47 | "nbconvert_exporter": "python", 48 | "pygments_lexer": "ipython2", 49 | "version": "2.7.11" 50 | } 51 | }, 52 | "nbformat": 4, 53 | "nbformat_minor": 0 54 | } 55 | -------------------------------------------------------------------------------- /Mock Interviews/Ride Share Start-Up Company/Ride Share Company - Interview Questions/Phone Screen .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try explaining your solution to someone and see if it makes sense ot them. Don't code anything for this problem **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 1-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try pen/paper before coding out your solution **\n", 16 | "\n", 17 | "** You can not use an integer element twice. Optimize for time over space **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 2", 31 | "language": "python", 32 | "name": "python2" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 2 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython2", 44 | "version": "2.7.11" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 0 49 | } 50 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 2-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Do not use built-in Python functions or methods **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/On-Site Question 3-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Your function should be able to perform this in less than O(nlogn) time. **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/.ipynb_checkpoints/Phone Screen -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem \n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "**Complete this problem on a text editor that does not have syntax highlighting, such as a goolge doc!**" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 1 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Try pen/paper before coding out your solution **\n", 16 | "\n", 17 | "** You can not use an integer element twice. Optimize for time over space **" 18 | ] 19 | }, 20 | { 21 | "cell_type": "markdown", 22 | "metadata": {}, 23 | "source": [ 24 | "# Good Luck!" 25 | ] 26 | } 27 | ], 28 | "metadata": { 29 | "kernelspec": { 30 | "display_name": "Python 2", 31 | "language": "python", 32 | "name": "python2" 33 | }, 34 | "language_info": { 35 | "codemirror_mode": { 36 | "name": "ipython", 37 | "version": 2 38 | }, 39 | "file_extension": ".py", 40 | "mimetype": "text/x-python", 41 | "name": "python", 42 | "nbconvert_exporter": "python", 43 | "pygments_lexer": "ipython2", 44 | "version": "2.7.11" 45 | } 46 | }, 47 | "nbformat": 4, 48 | "nbformat_minor": 0 49 | } 50 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 2.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 2 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Do not use built-in Python functions or methods **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/On-Site Question 3.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# On-Site Question 3 \n", 8 | "\n", 9 | "## Problem\n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "** Your function should be able to perform this in less than O(nlogn) time. **" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /Mock Interviews/Social Network Company/Social Network Company - Interview Questions/Phone Screen .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Phone Screen \n", 8 | "\n", 9 | "## Problem \n", 10 | "\n", 11 | "** 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", 12 | "\n", 13 | "## Requirements\n", 14 | "\n", 15 | "**Complete this problem on a text editor that does not have syntax highlighting, such as a goolge doc!**" 16 | ] 17 | }, 18 | { 19 | "cell_type": "markdown", 20 | "metadata": {}, 21 | "source": [ 22 | "# Good Luck!" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 2", 29 | "language": "python", 30 | "name": "python2" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 2 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython2", 42 | "version": "2.7.11" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 0 47 | } 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python for Algorithms, Data-Structures, and Interviews! 2 | #### Welcome to the repository for the Udemy Course: Python for Algorithms, Data Structures, and Interviews! 3 | 4 | This is the ultimate course in preparing you for your technical interviews and landing the job of your dreams! 5 | 6 | Get the entire course, including full video content, solution walkthroughs, discussion forums, instructor support, 7 | 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)! 8 | 9 | 10 | -------------------------------------------------------------------------------- /Reflect Notes.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Array\n", 8 | "- Python use reference when slide or extend an array. (Because python uses immutable value for integers and strings)\n", 9 | "## Dynamic Array Implementation\n", 10 | "- The array has an initial size and will expand twice when extending.\n" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "\" \".join()\n", 20 | "reversed()\n", 21 | "s.split()\n", 22 | "len(set(s))" 23 | ] 24 | } 25 | ], 26 | "metadata": { 27 | "kernelspec": { 28 | "display_name": "Python 3", 29 | "language": "python", 30 | "name": "python3" 31 | }, 32 | "language_info": { 33 | "codemirror_mode": { 34 | "name": "ipython", 35 | "version": 3 36 | }, 37 | "file_extension": ".py", 38 | "mimetype": "text/x-python", 39 | "name": "python", 40 | "nbconvert_exporter": "python", 41 | "pygments_lexer": "ipython3", 42 | "version": "3.6.2" 43 | } 44 | }, 45 | "nbformat": 4, 46 | "nbformat_minor": 2 47 | } 48 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Bridge Crossing-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Bridge Crossing" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Problem Statement\n", 15 | "\n", 16 | "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", 17 | "\n", 18 | "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", 19 | "\n", 20 | "What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?\n", 21 | "\n" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 2", 28 | "language": "python", 29 | "name": "python2" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 2 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython2", 41 | "version": "2.7.11" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 0 46 | } 47 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Coins and a Scale -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Coins and a Scale \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 2", 17 | "language": "python", 18 | "name": "python2" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 2 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython2", 30 | "version": "2.7.11" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Egg Drop -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Egg Drop \n", 8 | "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", 9 | "## Problem Statement\n", 10 | "\n", 11 | "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", 12 | "\n", 13 | "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)" 14 | ] 15 | } 16 | ], 17 | "metadata": { 18 | "kernelspec": { 19 | "display_name": "Python 2", 20 | "language": "python", 21 | "name": "python2" 22 | }, 23 | "language_info": { 24 | "codemirror_mode": { 25 | "name": "ipython", 26 | "version": 2 27 | }, 28 | "file_extension": ".py", 29 | "mimetype": "text/x-python", 30 | "name": "python", 31 | "nbconvert_exporter": "python", 32 | "pygments_lexer": "ipython2", 33 | "version": "2.7.11" 34 | } 35 | }, 36 | "nbformat": 4, 37 | "nbformat_minor": 0 38 | } 39 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Hallway Lockers-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Hallway Lockers\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 2", 17 | "language": "python", 18 | "name": "python2" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 2 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython2", 30 | "version": "2.7.11" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Jugs of Water -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Jugs of Water \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 2", 17 | "language": "python", 18 | "name": "python2" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 2 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython2", 30 | "version": "2.7.11" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Light Switches -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Light Switches\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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", 11 | "\n", 12 | "**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" 13 | ] 14 | } 15 | ], 16 | "metadata": { 17 | "kernelspec": { 18 | "display_name": "Python 2", 19 | "language": "python", 20 | "name": "python2" 21 | }, 22 | "language_info": { 23 | "codemirror_mode": { 24 | "name": "ipython", 25 | "version": 2 26 | }, 27 | "file_extension": ".py", 28 | "mimetype": "text/x-python", 29 | "name": "python", 30 | "nbconvert_exporter": "python", 31 | "pygments_lexer": "ipython2", 32 | "version": "2.7.11" 33 | } 34 | }, 35 | "nbformat": 4, 36 | "nbformat_minor": 0 37 | } 38 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/.ipynb_checkpoints/Ropes Burning-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ropes Burning \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "You have two ropes. Each takes exactly 60 minutes to burn.\n", 11 | "\n", 12 | "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", 13 | "\n", 14 | "How do you measure out exactly 45 minutes?" 15 | ] 16 | } 17 | ], 18 | "metadata": { 19 | "kernelspec": { 20 | "display_name": "Python 2", 21 | "language": "python", 22 | "name": "python2" 23 | }, 24 | "language_info": { 25 | "codemirror_mode": { 26 | "name": "ipython", 27 | "version": 2 28 | }, 29 | "file_extension": ".py", 30 | "mimetype": "text/x-python", 31 | "name": "python", 32 | "nbconvert_exporter": "python", 33 | "pygments_lexer": "ipython2", 34 | "version": "2.7.11" 35 | } 36 | }, 37 | "nbformat": 4, 38 | "nbformat_minor": 0 39 | } 40 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Bridge Crossing.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Bridge Crossing" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Problem Statement\n", 15 | "\n", 16 | "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", 17 | "\n", 18 | "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", 19 | "\n", 20 | "What is the least amount of time in which all the travelers can cross from one side of the bridge to the other?\n", 21 | "\n" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 2", 28 | "language": "python", 29 | "name": "python2" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 2 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython2", 41 | "version": "2.7.11" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 0 46 | } 47 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Coins and a Scale .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Coins and a Scale \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 2", 17 | "language": "python", 18 | "name": "python2" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 2 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython2", 30 | "version": "2.7.11" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Egg Drop .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Egg Drop \n", 8 | "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", 9 | "## Problem Statement\n", 10 | "\n", 11 | "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", 12 | "\n", 13 | "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)" 14 | ] 15 | } 16 | ], 17 | "metadata": { 18 | "kernelspec": { 19 | "display_name": "Python 2", 20 | "language": "python", 21 | "name": "python2" 22 | }, 23 | "language_info": { 24 | "codemirror_mode": { 25 | "name": "ipython", 26 | "version": 2 27 | }, 28 | "file_extension": ".py", 29 | "mimetype": "text/x-python", 30 | "name": "python", 31 | "nbconvert_exporter": "python", 32 | "pygments_lexer": "ipython2", 33 | "version": "2.7.11" 34 | } 35 | }, 36 | "nbformat": 4, 37 | "nbformat_minor": 0 38 | } 39 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Hallway Lockers.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Hallway Lockers\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 2", 17 | "language": "python", 18 | "name": "python2" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 2 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython2", 30 | "version": "2.7.11" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Jugs of Water .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Jugs of Water \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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?" 11 | ] 12 | } 13 | ], 14 | "metadata": { 15 | "kernelspec": { 16 | "display_name": "Python 2", 17 | "language": "python", 18 | "name": "python2" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 2 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython2", 30 | "version": "2.7.11" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Light Switches .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Light Switches\n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "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", 11 | "\n", 12 | "**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" 13 | ] 14 | } 15 | ], 16 | "metadata": { 17 | "kernelspec": { 18 | "display_name": "Python 2", 19 | "language": "python", 20 | "name": "python2" 21 | }, 22 | "language_info": { 23 | "codemirror_mode": { 24 | "name": "ipython", 25 | "version": 2 26 | }, 27 | "file_extension": ".py", 28 | "mimetype": "text/x-python", 29 | "name": "python", 30 | "nbconvert_exporter": "python", 31 | "pygments_lexer": "ipython2", 32 | "version": "2.7.11" 33 | } 34 | }, 35 | "nbformat": 4, 36 | "nbformat_minor": 0 37 | } 38 | -------------------------------------------------------------------------------- /Riddles/Riddle Interview Problems/Riddle Interview Problems/Ropes Burning.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Ropes Burning \n", 8 | "## Problem Statement\n", 9 | "\n", 10 | "You have two ropes. Each takes exactly 60 minutes to burn.\n", 11 | "\n", 12 | "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", 13 | "\n", 14 | "How do you measure out exactly 45 minutes?" 15 | ] 16 | } 17 | ], 18 | "metadata": { 19 | "kernelspec": { 20 | "display_name": "Python 2", 21 | "language": "python", 22 | "name": "python2" 23 | }, 24 | "language_info": { 25 | "codemirror_mode": { 26 | "name": "ipython", 27 | "version": 2 28 | }, 29 | "file_extension": ".py", 30 | "mimetype": "text/x-python", 31 | "name": "python", 32 | "nbconvert_exporter": "python", 33 | "pygments_lexer": "ipython2", 34 | "version": "2.7.11" 35 | } 36 | }, 37 | "nbformat": 4, 38 | "nbformat_minor": 0 39 | } 40 | -------------------------------------------------------------------------------- /Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Deque -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Deque \n", 8 | "\n", 9 | "Finally, implement a Deque class! It should be able to do the following:\n", 10 | "\n", 11 | "* Check if its empty\n", 12 | "* Add to both front and rear\n", 13 | "* Remove from Front and Rear\n", 14 | "* Check the Size" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "class Deque(object):\n", 26 | " pass" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 2", 33 | "language": "python", 34 | "name": "python2" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 2 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython2", 46 | "version": "2.7.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 0 51 | } 52 | -------------------------------------------------------------------------------- /Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Queue-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Queue\n", 8 | "\n", 9 | "It's very common to be asked to implement a Queue class! The class should be able to do the following:\n", 10 | "\n", 11 | "* Check if Queue is Empty\n", 12 | "* Enqueue\n", 13 | "* Dequeue\n", 14 | "* Return the size of the Queue" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "class Queue(object):\n", 26 | " pass" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 2", 33 | "language": "python", 34 | "name": "python2" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 2 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython2", 46 | "version": "2.7.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 0 51 | } 52 | -------------------------------------------------------------------------------- /Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/.ipynb_checkpoints/Implement a Stack -checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Stack \n", 8 | "\n", 9 | "A very common interview question is to begin by just implementing a Stack! Try your best to implement your own stack!\n", 10 | "\n", 11 | "It should have the methods:\n", 12 | "\n", 13 | "* Check if its empty\n", 14 | "* Push a new item\n", 15 | "* Pop an item\n", 16 | "* Peek at the top item\n", 17 | "* Return the size" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "metadata": { 24 | "collapsed": true 25 | }, 26 | "outputs": [], 27 | "source": [ 28 | "class Stack(object):\n", 29 | " \n", 30 | " \n", 31 | " # Fill out the Stack Methods here\n", 32 | " pass" 33 | ] 34 | } 35 | ], 36 | "metadata": { 37 | "kernelspec": { 38 | "display_name": "Python 2", 39 | "language": "python", 40 | "name": "python2" 41 | }, 42 | "language_info": { 43 | "codemirror_mode": { 44 | "name": "ipython", 45 | "version": 2 46 | }, 47 | "file_extension": ".py", 48 | "mimetype": "text/x-python", 49 | "name": "python", 50 | "nbconvert_exporter": "python", 51 | "pygments_lexer": "ipython2", 52 | "version": "2.7.10" 53 | } 54 | }, 55 | "nbformat": 4, 56 | "nbformat_minor": 0 57 | } 58 | -------------------------------------------------------------------------------- /Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Deque .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Deque \n", 8 | "\n", 9 | "Finally, implement a Deque class! It should be able to do the following:\n", 10 | "\n", 11 | "* Check if its empty\n", 12 | "* Add to both front and rear\n", 13 | "* Remove from Front and Rear\n", 14 | "* Check the Size" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "class Deque(object):\n", 26 | " pass" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 2", 33 | "language": "python", 34 | "name": "python2" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 2 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython2", 46 | "version": "2.7.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 0 51 | } 52 | -------------------------------------------------------------------------------- /Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Queue.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Queue\n", 8 | "\n", 9 | "It's very common to be asked to implement a Queue class! The class should be able to do the following:\n", 10 | "\n", 11 | "* Check if Queue is Empty\n", 12 | "* Enqueue\n", 13 | "* Dequeue\n", 14 | "* Return the size of the Queue" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": 1, 20 | "metadata": { 21 | "collapsed": true 22 | }, 23 | "outputs": [], 24 | "source": [ 25 | "class Queue(object):\n", 26 | " pass" 27 | ] 28 | } 29 | ], 30 | "metadata": { 31 | "kernelspec": { 32 | "display_name": "Python 2", 33 | "language": "python", 34 | "name": "python2" 35 | }, 36 | "language_info": { 37 | "codemirror_mode": { 38 | "name": "ipython", 39 | "version": 2 40 | }, 41 | "file_extension": ".py", 42 | "mimetype": "text/x-python", 43 | "name": "python", 44 | "nbconvert_exporter": "python", 45 | "pygments_lexer": "ipython2", 46 | "version": "2.7.10" 47 | } 48 | }, 49 | "nbformat": 4, 50 | "nbformat_minor": 0 51 | } 52 | -------------------------------------------------------------------------------- /Stacks, Queues and Deques/Stacks, Queues, and Deques Interview Problems/Stacks, Queues, Deques Interview Questions/Implement a Stack .ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Implement a Stack \n", 8 | "\n", 9 | "A very common interview question is to begin by just implementing a Stack! Try your best to implement your own stack!\n", 10 | "\n", 11 | "It should have the methods:\n", 12 | "\n", 13 | "* Check if its empty\n", 14 | "* Push a new item\n", 15 | "* Pop an item\n", 16 | "* Peek at the top item\n", 17 | "* Return the size" 18 | ] 19 | }, 20 | { 21 | "cell_type": "code", 22 | "execution_count": 1, 23 | "metadata": { 24 | "collapsed": true 25 | }, 26 | "outputs": [], 27 | "source": [ 28 | "class Stack(object):\n", 29 | " \n", 30 | " \n", 31 | " # Fill out the Stack Methods here\n", 32 | " pass" 33 | ] 34 | } 35 | ], 36 | "metadata": { 37 | "kernelspec": { 38 | "display_name": "Python 2", 39 | "language": "python", 40 | "name": "python2" 41 | }, 42 | "language_info": { 43 | "codemirror_mode": { 44 | "name": "ipython", 45 | "version": 2 46 | }, 47 | "file_extension": ".py", 48 | "mimetype": "text/x-python", 49 | "name": "python", 50 | "nbconvert_exporter": "python", 51 | "pygments_lexer": "ipython2", 52 | "version": "2.7.10" 53 | } 54 | }, 55 | "nbformat": 4, 56 | "nbformat_minor": 0 57 | } 58 | --------------------------------------------------------------------------------