
Master JavaScript algorithms and data structures through challenge-based learning that strengthens problem solving and interview prep, with clear explanations and Jest-backed documentation for intermediate learners.
Explore the course structure, from basic loop challenges like fizzbuzz to advanced data structures, recursion, and graph and tree traversals, across JavaScript, with attention to time and space complexity.
Learn what algorithms and data structures are, and explore how to implement and apply them in JavaScript through custom classes, traversals, and practical challenges.
Set up your development environment with a sandbox of challenges, solutions, and tests. Use Visual Studio Code, Node.js, Git, Jest, Code Runner, and prettier extensions.
Explore the traverse js challenges sandbox, set up your workspace with readme files, npm, jest, and vscode, and run tests to study the hello world entry.
Create a hello world function that returns the string 'Hello world!' and verify it by logging the result, running tests with jest and npm test.
Define get sum, a function that takes two numbers and returns their sum using the plus operator, with tests run via npm test and jest.
Build a calculator function that takes two numbers and an operator string, returns the result, uses switch or if-else, and throws an error for an invalid operator.
Implement a count occurrences function that takes a string and a character and returns how many times that character appears, using a for loop and the split method.
Learn to implement a function that returns the max number from an array, using both Math.max with spread and a for loop, with test validation.
Implement a title case function that takes a string and capitalizes the first letter of each word, using split, toLowerCase, and join to rebuild the sentence.
Learn to reverse a string in JavaScript using split, reverse, and join or a manual for loop, with stack and linked list approaches.
Explore palindrome concepts by implementing isPalindrome in JavaScript, handling alphanumeric filtering, and comparing formatted strings using regex and a non-regex approach.
Count vowels demonstrates taking a string, converting it to lowercase, and using a for loop to iterate through characters, count vowels, and return the total.
Remove duplicates from an input array by implementing a function that returns a new, unique array for any data type, using a for loop or a set.
Develop a fizzbuzz array function in JavaScript that returns an array from 1 to n, pushing each number, or fizz, buzz, or fizzbuzz based on divisibility by 3 and 5.
Learn to compute the intersection of two arrays by finding common elements using includes or a set, with practical JavaScript examples and tests.
Create a display likes function that formats an array of names into exact phrases for zero, one, two, three, or more than three likes, using template literals and conditional logic.
Find the missing number in a 1-to-n array using the Goss formula to compute the expected sum and subtract the actual sum. Use for loop and reduce as methods.
Demonstrate two methods to find the missing letter in a letter sequence: use the alphabet string and indexOf, or use charCodeAt and fromCharCode; return empty string if none.
Explore implementing a function that checks whether all characters are unique in JavaScript, returning true or false, using an object or a set to detect duplicates with case sensitivity.
Identify the first non-repeating character by counting occurrences with an object or map, then return the first character with count one; otherwise return null.
Create a dice game simulation function using Math.random to roll dice, returning results with dice1, dice2, sum, and win/lose/roll again status; 7 or 11 win, 2, 3, or 12 lose.
Learn to format a ten-digit number as a US phone number in JavaScript by building a formatPhoneNumber function that uses array slice and join, with multiple solution approaches.
Create a JavaScript validate email function that returns true for strings with an at symbol and a period, using regex test or a non-regex split and domain check.
Explore high-order array methods in javascript—map, filter, reduce, find, some, and every—using a simple 1–5 array to transform, filter, and sum with clean, readable code.
Learn to compute the sum of squares of even numbers in an array by chaining filter, map, and reduce in JavaScript. It covers handling empty arrays.
Calculate the total sales for a list of products by summing price times quantity and applying a tax rate, using a reduce-based approach with two decimal places.
Learn to find the highest scoring word by splitting the input into words, mapping letters to scores, and reducing to the max, using lowercase letters and spaces.
Learn how to determine valid anagrams by splitting two strings into characters, building frequency count objects with reduce, and comparing the frequency maps to return true or false.
Build a hashtag generator function that converts input text into a capitalized hashtag, enforcing a 140-character limit and non-empty input, using map and reduce with trim, split, join.
Create a function to validate ipv4 addresses by splitting the input on dots into four octets, each 0–255, with no leading zeros, using parseInt and every.
Implement a JavaScript password validator function named validatePassword that checks length, uppercase, lowercase, and digits, using split to create characters and sum to verify each condition, returning true or false.
Refactor the find missing letter challenge to use high-order array methods—map, find, filter, and reduce—instead of for loops, converting character codes with fromCharCode and charCodeAt to identify the missing letter.
Learn the fundamentals of recursion, including base cases, call stacks, and unwinding, with simple examples like a countdown to compare recursion and iteration.
Master recursion basics, including base case, unwinding, and the call stack, so returns come in reverse order, illustrated with a sum up to n example.
Master recursion by reversing a string in JavaScript using a base case and substring, building the result as the function unwinds.
Learn how the Fibonacci sequence is computed with recursion in JavaScript, using a base case and the fib(n) = fib(n-1) + fib(n-2) formula, and explore index-based results and performance implications.
Learn recursion by computing factorials, using a base case of 0 or 1 and a recursive step that multiplies the current number by the factorial of the previous number.
Implement a recursive power function in JavaScript that computes base raised to exponent, with base case exponent zero equals one and a recursive step multiplying the base by power(base, exponent-1).
Learn to sum an array with recursion in JavaScript, using a base case of an empty array and a recursive step that adds the first element to the rest.
Create a number range function that returns an array from start num to end num, using a base case when start equals end and recursion to build the sequence.
Learn to flatten nested arrays of any depth by looping through elements, using recursion for arrays, concatenating results, and returning a single flat array.
Generate all permutations of a lowercase, duplicate-free string by recursively selecting each character as the first letter and permuting the rest.
Explore time complexity and runtime, and how input size affects performance. Learn the four main types, constant, linear, quadratic, and logarithmic, and the role of big O notation.
Explore constant time complexity (O(1)) with a simple array element access example that returns by index, demonstrating a fixed runtime regardless of input size.
Demonstrate linear time complexity by implementing a sum array function that iterates through the input and adds each element, illustrating time proportional to the data size (O(n)).
Explore quadratic time complexity, O(n^2), via a nested-loop example that processes an array and updates sums; observe how runtime grows with input size, becoming less efficient than linear time.
Understand space complexity with big O notation, measuring memory used by variables, data structures, and function calls, from constant to quadratic and beyond, with sliding window to linear solutions.
Implement a max subarray sum using an O(n^2) quadratic approach with nested loops for subarrays of length k, and preview refactoring to an O(n) sliding window solution.
The lecture demonstrates the sliding window technique to compute the maximum subarray sum for a given array and K, updating current and max sums as the window slides.
Explore hash tables as associative arrays, learn hash functions, key collisions, and how maps and sets in JavaScript relate to hash tables.
Explore how to create and manipulate maps in JavaScript, using key types, and iterate with for of, for each, keys, and values, including get, set, has, delete, and clear operations.
Build a word frequency counter in JavaScript using maps that returns the final map. Convert input to lowercase, remove punctuation with a regex, split into words, and tally counts.
Convert an array of 'name:phone' strings into a map of names to numbers, using split on colon, destructuring, and map.set.
Learn to group words by anagrams in JavaScript by using a map keyed with sorted characters, collecting words into arrays and returning an array of anagram groups.
Compute the symmetric difference between two arrays by using two sets to identify elements present in one array but not the other. Return a deduplicated result and verify with examples.
Learn to implement the two sum function in JavaScript using a set to track seen numbers, identify the complement, and return indices that add up to a target.
Explore how to compute the longest consecutive sequence in an array using a set in JavaScript, starting at numbers without a predecessor and expanding to count the sequence length.
Learn to implement a custom hash table in JavaScript, featuring set, get, and remove methods, a simple hash function, collision handling with buckets, and table printing.
Build and test a custom hash table with get, remove, has, and clear methods, handling collisions with buckets and iterating key-value pairs.
Count word occurrences with a custom hash table by normalizing to lowercase, splitting on non-word characters, and updating counts using get, set, and has.
Add a getValues method to the hash table that returns an array of all stored values. Iterate through buckets and key-value pairs, pushing each value and returning the array.
Implement an anagram grouping function using a custom hash table, sorting word characters to form keys and storing anagrams to return a nested array of groups from the input words.
Explore stacks, queues, and linked lists by visualizing a stack, learning the last in, first out principle, and implementing push and pop operations while examining the call stack and recursion.
Reverse a string using a stack by pushing each character and popping to build the result, demonstrating last in, first out behavior and practical JavaScript implementation.
implement a balanced parentheses checker using a stack to push opening parentheses and pop on closing ones, returning true when all are matched.
Explore palindrome detection using a queue and a stack by filtering a string to alphanumeric characters, enqueuing and pushing characters, then dequeuing and popping to verify symmetry.
Learn how singly linked lists use nodes and next pointers, with head and tail, to enable efficient insertion and deletion, dynamic size, and trade-offs with arrays.
Implement a JavaScript linked list with node and list classes, covering add, get, insert at, remove from, and print all, while traversing via next pointers and understanding O(n) access.
Learn to reverse a string with a linked list by inserting characters in reverse and traversing the list to build the reversed string, linking queue and stack approaches.
Explore how a doubly linked list uses next and previous pointers to enable bidirectional traversal, efficient insertion and deletion, and head and tail boundaries.
Build a doubly linked list in JavaScript using constructor functions and prototypes, and implement append, prepend, insert at, and print all with head, tail, and length.
Build and test a doubly linked list in JavaScript by adding get, remove, and contains methods, updating head, tail, and pointers, and validating with tests.
Explore binary trees and their vocabulary—nodes, edges, root, leaves, depth, height, and paths—and see how these structures power file systems, dom, and search algorithms.
Create a tree node class with a value and left and right pointers initialized to null, then build a binary tree with tests and prepare for depth-first and breadth-first traversals.
Learn depth-first traversal of a binary tree using recursion. A recursive traverse function pushes node data into a result array and visits left and right from the root.
Traverse binary trees with breadth first traversal using a queue to visit all nodes at each depth from left to right, and implement the approach in JavaScript.
Learn to compute the maximum depth of a binary tree by counting the nodes along the longest path from root to the furthest leaf, via depth first traversal and recursion.
Explore binary search trees and their ordering rules, showing how left nodes are less and right nodes are greater, and master insert, search, and delete operations with efficiency.
Implement a binary search tree in JavaScript with a Node class and a BST featuring insert, lookup, remove, and an in-order print traversal.
Learn to implement a binary search tree with insertion, lookup, and removal, handle two-child and root replacement scenarios, and validate the binary search tree.
Validate a binary search tree with a recursive helper using min and max bounds to check subtrees, ensuring left nodes stay under the max and right nodes above the min.
Explore graph data structures by examining nodes, vertices, and edges with weights. Compare undirected and directed graphs, cycles, connected and disconnected graphs, and representations via adjacency matrices or adjacency lists.
Compare adjacency matrix and adjacency list representations of a graph, using a five-vertex example to show edges as ones and zeros and lists of connected vertices.
Implement a graph in JavaScript using an adjacency list, with add vertex, add edge, print adjacency list, remove edge, and remove vertex. Preview traversal concepts like depth-first and breadth-first.
Explore depth-first and breadth-first traversals on graphs, using a stack and a queue to visit all vertices, starting from any vertex.
Learn to implement a depth-first traversal on a graph using a stack, a visited set, and an adjacency list, starting from a chosen vertex to produce a specific visit order.
Learn to perform a graph breadth-first traversal using a queue and a visited set, starting at a vertex, enqueuing unvisited neighbors to yield A, B, C, D, E, F.
Explore sorting algorithms, including bubble, insertion, selection, merge, and quicksort, and learn how recursion and divide-and-conquer strategies sort data. Understand time and space complexity with big O notation.
Implement bubble sort to sort an array of unique positive integers by repeatedly comparing adjacent items and swapping with a temp variable, using two loops, then verify with npm test.
Master insertion sort by building a sorted portion from an unsorted array, shifting larger elements right, and inserting each current element to produce a fully sorted result.
Explore the selection sort algorithm by dividing the array into sorted and unsorted portions, swapping the minimum into place each pass, and noting its O(n^2) time complexity.
implement a JavaScript selection sort that orders an array of unique positive integers by repeatedly selecting the minimum from the unsorted portion and swapping it to the front.
Apply the merge sort algorithm, a divide-and-conquer approach that splits the array in half, then merges sorted subarrays to produce a fully sorted array, with efficient O(n log n) performance.
Implement a JavaScript merge sort using divide and conquer, recursively splitting arrays and merging sorted halves with a merge function, delivering an efficient O(n log n) sort.
Explore the quicksort algorithm, a divide-and-conquer sort that uses a pivot to partition the array into subarrays and recursively sorts them for efficient sorting, with space-efficient performance.
Implement quicksort in JavaScript by selecting a pivot, partitioning the array, and recursively sorting left and right subarrays, achieving o(n log n) on average with o(n^2) worst-case.
Most of my students know me for my practical, project-based courses and tutorials. I wanted to create something to give you more fundamental skills for problem solving. That's where the idea for this challenges course came from. I want to take my down-to-earth explanations to help you get a better understanding of the code that you write and help you write more efficient code.
This course is for all levels as long as you have a basic understanding of things like loops, functions, arrays, etc. We are writing JavaScript in this course, but about 95% of it can translate to any other language. So even if you are a Python, PHP or C# developer, you can still follow along.
Basic Challenges:
We start with a bunch of basic challenges that have to do with iteration and loops. Things like FizzBuzz and string reversals. These are very popular questions for entry-level interviews. We also move on to solving problems with high order array methods like filter and map.
Recursion:
Recursion is one of the toughest things to learn in programming. We have an entire section dedicated to it with challenges that we solve using recursion.
Time & Space Complexity:
We talk about how to measure an algorithm or function's efficiency by using time and space complexity to see how the runtime and memory scale when inscreasing the input.
Data Structures: Stacks, Queues, Trees, Linked Lists, Graphs, HashMaps
We go over all of the common data structures and create our own implementation of them using JavaScript classes, but like I said, you could use any language. We also learn how to traverse them and complete challenges using them.
Sorting Algorithms:
We get into different sorting algorithms like bubble sort, insertion, selection, merge and quick sort. These are popular topics for interviews.