摘要:
题目: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 comp... 阅读全文
摘要:
题目:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 2^31 - 1.For example,123 -> "One Hund... 阅读全文
摘要:
题目: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 comp... 阅读全文
摘要:
题目: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 comp... 阅读全文
摘要:
题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transacti... 阅读全文
摘要:
题目:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1... 阅读全文
摘要:
线段树(segment tree)是一种Binary Search Tree或者叫做ordered binary tree。对于线段树中的每一个非叶子节点[a,b],它的左子树表示的区间为[a,(a+b)/2],右子树表示的区间为[(a+b)/2+1,b]。如下图: ... 阅读全文
摘要:
题目:Additive number is a positive integer whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Exce... 阅读全文
摘要:
题目:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (r... 阅读全文
摘要:
题目:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumR... 阅读全文