All tags
Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Fibonacci
Implement a function
that returns the fibonacci number at a given index
. Implement this memoized.
Anagrams
Anagrams are words
or phrases
that contain the same number of characters. Create a function
that checks for this.
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.
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)