-
2. Recursions
-
2
Sigma
<p>Before you work on the first recursion challenge, it's best that you solve these challenges first using Javascript (for now). Although you could also approach these challenges using Python or ... -
3
Factorial
<p>Using recursion, write a function factorial(num) that, given a number, returns the product (multiplication) of all positive integers from 1 up to the given number (inclusive). For example, factoria ... -
4
Fibonacci
<p>Create a function to generate Fibonacci numbers. In this famous mathematical sequence, each number is the sum of the previous two, starting with values 0 and 1. Your function should accept one argu ... -
5
Zibonacci
<p>This function borrows ideas from the Fibonacci series, but the calculated results appear to zig and zag, hence the name. A so-called 'Zibonacci' series would be defined by the following rules:</p> ... -
6
String Anagrams
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391382394" ></iframe></figure> <p></p> <p>Given a string, use recursion to return array where each element is a st ... -
7
Binary String Expansion
<p>You are given a string containing chars '0', '1', and '?'. For every '?', either '0' or '1' can be substituted. Write a recursive function to return array of all valid strings with '?' chars expa ... -
8
Telephone Words
<p>Nikki has a new phone number (304-5083) and wants to create a clever way for everyone to remember it. On older telephones, the keypad associates letters with each numeral. Given a seven-digit telep ... -
9
All Valid N Pairs of Parens
<p>Given the number of pairs of parentheses, return an array of strings, where each string represents a different valid way to order those parentheses. Example: given <strong>2</strong>, return <stron ... -
10
Recursive Binary Search
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391383406" ></iframe></figure> <p><br>Given a sorted array and a value, recursively determine whether value is foun ... -
4. Sorting
-
12
BubbleSort
<p>If you were to go through 10-15 interviews, chances are that you'll be asked questions related to sorting and orders of operations. </p> <p>To prepare you for these type of interview questions, we ... -
13
SelectionSort
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391324750" ></iframe></figure> <p>Selection sort is another sorting algorithm that is similar to bubble sort in tha ... -
14
InsertionSort
<p>Insertion sort is another popular sorting algorithm that builds the final sorted array one item at a time. It is more efficient than bubble sort although it's not as efficient as other sorting alg ... -
15
QuickSort
<p>QuickSort is a popular sorting algorithm that uses recursion (through its divide and conquer approach). Unlike other sorting algorithms such as bubble sort or insertion sort that is O(n^2), QuickS ... -
5. Nodes
-
16
Adding a node (part I)
<p>Imagine that we have a class called Node with two attributes: value and next. Each node can have a value (e.g. a number such as 5 or 17) and where next points can point to another node.<br></p> <p ... -
17
Adding a node (part II)
<p>Continuing from the previous exercise, now create five nodes and have all of these five nodes be connected to look like this.<br></p> <p>3 -> 5 -> 7 -> 1 -> 2</p> <p>Once way to do th ... -
18
Removing a node (part I)
<p>Consider the code below. Note how 5 nodes are connected this way:<br></p> <p>3 -> 5 -> 7 -> 1 -> 2<br></p> <p>In this exercise, your task is to add the appropriate code below so that ... -
19
Removing a node (part II)
<p>Repetition helps. Let's do another exercise where there are 5 nodes that are connected but where you “remove” the 2<sup>nd</sup>, 3<sup>rd</sup>, and 4<sup>th</sup> node so that the first node conn ... -
20
Inserting a node (part I)
<p>Now that you got familiar with removing a node, let's now have you insert a new node between two nodes. Imagine nodes that are connected as follows:<br></p> <p>3 -> 5 -> 7<br></p> <p>Write ... -
21
Printing values in the nodes
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391317355" ></iframe></figure> <p>In the previous exercises, you've seen how starting from the first node, we could ... -
6. Singly Linked List
-
22
Adding a node to the back
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391328320" ></iframe></figure> <p>Instead of creating a variable whenever we create a node, there is a better way t ... -
23
Adding a node to the front
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391329469" ></iframe></figure> <p>Your objective is to create two methods for the singly linked list: add_to_front( ... -
24
Remove from front
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391670424" ></iframe></figure> <p>This time, implement remove_from_front where it removes the first node and return ... -
25
Remove from back
<p>This time, implement remove_from_back where it removes the last node and returns its value. If there is no node to remove, have it return false.</p> <p>For example, consider a singly linked list t ... -
26
Remove Value
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391670919" ></iframe></figure> <p>Given a singly linked list, remove the first node with the given value.</p> <p>F ... -
27
Insert At
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391671271" ></iframe></figure> <p>Insert a node with value val as the nth node. Consider the first node to be at t ... -
7. Queues and Stacks
-
28
Implementing Queues
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391671732" ></iframe></figure> <p>We're told: <em>wait our turn</em>. Queues enforce this, as Sequential data stru ... -
29
Implementing Stacks
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391671823" ></iframe></figure> <p>Stacks and Queues are companion data structures. Both are sequential, meaning th ... -
30
Priority Queue
<p></p> <p>Another data structure, you'll hear quite a bit during technical interview is a term called 'Priority Queue'. This is just like a normal Queue but where you can have the queue be arranged ... -
8. Doubly Linked List
-
31
Introduction
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391765015" ></iframe></figure> <p>There is certainly no reason why a linked list node must refer to only one other ... -
32
Delete Middle Node
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391765601" ></iframe></figure> <p>Given node in the middle of a DList (that has odd number of nodes), remove the mi ... -
9. Binary Search Tree
-
33
BST add
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391764320" ></iframe></figure> <p>Let's now explore an important data structure called Binary Search Tree or in sho ... -
34
BST depth-first search
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391764778" ></iframe></figure> <p>There are two main ways of searching through a binary search tree: depth-first se ... -
10. Hash Table
-
35
Creating a hash table
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391765807" ></iframe></figure> <p>Hash table, or also called hash map, is a data structure that implements an assoc ... -
36
Adding a key value pair
<figure><iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/391765763" ></iframe></figure> <p>Now, implement add(key, value) where given a key, it creates a new node and store ... -
1. Overview
-
FORUM
-
11. Design Patterns
-
FORUM
-
3. Dynamic Programming
-
11
Fibonacci
<p>Previously, you may have solved a Fibonacci series using recursions as follows:</p> <pre>function fib(n){ if(n<=1){ return n; } return fib(n-2)+fib(n-1); }<div class="prel ...