Solve coding challenges in JavaScript. Cover standard algorithm topics and key JS-specific features like closures, prototypal inheritance, and promises.
Given an array of integers `nums` and an integer `target`, return the indices of the two numbers that add up to `target`. You may assume that each input has exactly one solution, and you may not use the same element twice.
Given two sorted integer arrays nums1 and nums2, merge them into a single sorted array and return it.
Given n non-negative integers a1, a2, ..., an where each represents a point at coordinate (i, ai), find two lines that together with the x-axis form a container that holds the most water.
Write a function that reverses a string. The input string is given as an array of characters. You must do this by modifying the input array in-place with O(1) extra memory.
Given a string `s`, return true if it is a palindrome after converting all uppercase letters to lowercase and removing all non-alphanumeric characters.
Given an integer n, return a string array where for each number from 1 to n: if divisible by 3, add "Fizz"; if divisible by 5, add "Buzz"; if divisible by both, add "FizzBuzz"; otherwise add the number as a string.
Given a string s, find the length of the longest substring without repeating characters.
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: open brackets are closed by the same type, and open brackets are closed in the correct order.
Given the head of a linked list, determine if the linked list has a cycle in it. A cycle exists if a node can be reached again by continuously following the next pointer.
Given an integer array `nums`, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?