All problems

Sort Colors

Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.

Fibonacci

Implement a function that returns the fibonacci number at a given index. Implement this memoized.

Maximum Number of Events That Can Be Attended

Given an array of events where events[i] = [startDayi, endDayi].

Anagrams

Anagrams are words or phrases that contain the same number of characters. Create a function that checks for this.

Binary Search

Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums.

Add Strings

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.

Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i.

Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times).

All Possible Full Binary Trees

A full binary tree is a binary tree where each node has exactly 0 or 2 children.

Return a list of all possible full binary trees with N nodes. Each element of the answer is the root node of one possible tree.

Split Array Into Consecutive Subsequences

Given an array nums sorted in ascending order, return true if and only if you can split it into 1 or more subsequences such that each subsequence consists of consecutive integers and has length at least 3.

Caesar Cipher

Julius Caesar protected his confidential information by encrypting it using a cipher.

Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, .

Rod Cutting

Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces. For example, if length of the rod is 8 and the values of different pieces are given as following, then the maximum obtainable value is 22 (by cutting in two pieces of lengths 2 and 6)