Daily Coding Challenges

30 short JavaScript coding challenges across algorithms, strings, language quirks, debugging and regex. Write your solution in the browser, run the tests instantly, and come back for the daily challenge — the same one for everyone each day.

Category
Difficulty

Algorithms

10
Easy

Two Sum

Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`. You may assume exactly one solution exists, and you may not use the same element twice.

arrayhash-map
Easy

Reverse String

Write a function that reverses a string. The input is given as an array of characters. Modify the array in-place and return the reversed array.

stringtwo-pointers
Easy

FizzBuzz

Return an array containing strings from 1 to `n`. For multiples of 3 use "Fizz", for multiples of 5 use "Buzz", for multiples of both use "FizzBuzz". Otherwise, use the number as a string.

loopsmodulo
Easy

Palindrome Check

Given a string, return `true` if it is a palindrome considering only alphanumeric characters (case-insensitive). Otherwise return `false`.

stringtwo-pointers
Easy

Fibonacci

Return the n-th Fibonacci number where F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1.

dprecursion
Medium

Binary Search

Given a sorted array of integers `nums` and a `target`, return the index of `target` if found. Otherwise return -1. Your algorithm must run in O(log n) time.

binary-searcharray
Medium

Merge Sorted Arrays

Given two sorted arrays `a` and `b`, return a new sorted array containing all elements from both inputs. O(n + m) time expected.

arraytwo-pointersmerge
Medium

Maximum Subarray Sum

Given an integer array `nums`, return the largest sum of any contiguous subarray. (Kadane's algorithm.)

dpkadanearray
Easy

Valid Parentheses

Given a string `s` containing only the characters `()[]{}`, return `true` if it is a valid, properly nested bracket sequence.

stackstring
Medium

Rotate Array

Rotate the array `nums` to the right by `k` steps, where `k` is non-negative. Return the rotated array.

arrayrotation

String Manipulation

5

JavaScript Quirks

5

Debugging

5

Regex

5