Skip to main content

Algorithms

General

  • πŸ§‘β€πŸŽ“ AlgoExpert β€’ The ultimate resource to prepare for coding interviews. Everything you need, in one streamlined platform.
  • πŸ§‘β€πŸŽ“ Interview Cake β€’ Programming interview questions + help getting job offers
  • algorithms β€’ Code / tests for algorithm and data structure lessons using TypeScript / JavaScript β€’ Basarat Ali πŸ› οΈ
  • Build Algorithms using Typescript β€’ Egghead course by Basarat Ali πŸ§‘β€πŸŽ“

Patterns

Strings

Numbers

Arrays

  • πŸ“Ί One Minute Utilities for JavaScript Arrays β€’ 5 minute video by Basarat Ali showing quick functions for checking in an input is an array, checking if two arrays are equal, return the min, max, sum or average value in an array of numbers, joining two arrays, returning the arrays unique items, return an array that inckudes all numbers in a range, and flatten an array of arrays into a single array

Sorting

Searching & Pathfinding

Recursion

Dynamic Programming

Optimizing

FizzBuzz

Given a number, n, for each integer i in the range from 1 to n inclusive, print one value per line as follows:

  • If i is a multiple of both 3 and 5, print FizzBuzz
  • If i is a multiple of 3 (but not 5), print Fizz
  • If i is a multiple of 5 (but not 3), print Buzz
  • If i is not a multiple of 3 or 5, print the value of i
function fizzBuzz(n: number): void {
  for (let i = 1; i <= n; i++) {
    let result: number | 'Fizz' | 'Buzz' | 'FizzBuzz' = i
 
    if (i % 15 === 0) {
        result = 'FizzBuzz'
    } else if (i % 5 === 0) {
        result = 'Buzz'
    } else if (i % 3 === 0) {
        result = 'Fizz'
    }
 
    console.log(result)
  }
}

Inbox