题目You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you
...
题目Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word i
...
题目Say you have an array for which the i^th element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may com
...
题目You are given a char array representing tasks CPU need to do. It contains capital letters A to Z where each letter represents a different task. Task
...
题目Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
For examp
...
题目Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
Example:
1234Input: 38Output: 2 Explanation: Th
...
题目Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]
...
题目Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order.
The graph is given as fo
...
题目Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two element
...
题目Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level an
...