# 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 🧑‍🎓

## 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

## 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)
}
}``````