09 2017 档案
摘要:Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents the k
阅读全文
摘要:Implement a magic directory with buildDict, and search methods. For the method buildDict, you'll be given a list of non-repetitive words to build a di
阅读全文
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: Note: Length of the array wil
阅读全文
摘要:Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: The two l
阅读全文
摘要:There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons,
阅读全文
摘要:Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node.
阅读全文
摘要:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.
阅读全文
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might
阅读全文
摘要:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ
阅读全文
摘要:If the depth of a tree is smaller than 5, then this tree can be represented by a list of three-digits integers. For each integer in this list: Given a
阅读全文
摘要:Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1element. We define an array is non-decre
阅读全文
摘要:Given a binary tree with n nodes, your task is to check if it's possible to partition the tree to two trees which have the equal sum of values after r
阅读全文
摘要:Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binar
阅读全文
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave
阅读全文
摘要:You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subseq
阅读全文
摘要:Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If the
阅读全文
摘要:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the or
阅读全文
摘要:You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the following algorithm: Create
阅读全文
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E
阅读全文
摘要:Given the root of a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one
阅读全文
摘要:Print a binary tree in an m*n 2D string array following these rules: Example 1: Example 2: Example 3: Note: The height of binary tree is in the range
阅读全文