Challenge 1 of 8
FizzBuzz value
Instructions
Write `fizzBuzz(n)` — `"Fizz"` if divisible by 3, `"Buzz"` by 5, `"FizzBuzz"` by both, else the number.
Editor
IntelliSense on
// Write your code below
Module 2 of 2
freeCodeCamp-style drills: chunk, flatten, unique, range, two-sum.
Algorithms · 0/8 completed · scroll down for every challenge
Challenge 1 of 8
Write `fizzBuzz(n)` — `"Fizz"` if divisible by 3, `"Buzz"` by 5, `"FizzBuzz"` by both, else the number.
Editor
IntelliSense on
// Write your code below
Challenge 2 of 8 · Factorial
Challenge 2 of 8
Write `factorial(n)` for n >= 0.
Editor
IntelliSense on
// Write your code below
Challenge 3 of 8 · Chunk array
Challenge 3 of 8
Write `chunk(arr, size)` splitting into subarrays of length `size` (last may be shorter).
Editor
IntelliSense on
// Write your code below
Challenge 4 of 8 · Flatten deep
Challenge 4 of 8
Write `flatten(arr)` that fully flattens nested arrays.
Editor
IntelliSense on
// Write your code below
Challenge 5 of 8 · Unique keep order
Challenge 5 of 8
Write `unique(arr)` removing duplicates and keeping first-seen order.
Editor
IntelliSense on
// Write your code below
Challenge 6 of 8 · Range
Challenge 6 of 8
Write `range(start, end)` inclusive integers from start to end (start <= end).
Editor
IntelliSense on
// Write your code below
Challenge 7 of 8 · Two sum indices
Challenge 7 of 8
Write `twoSum(nums, target)` returning the first pair of indices that add to target.
Editor
IntelliSense on
// Write your code below
Challenge 8 of 8 · Max profit
Challenge 8 of 8
Write `maxProfit(prices)` — max difference later - earlier price, or 0.
Editor
IntelliSense on
// Write your code below
Next module