摘要:
There are n different online courses numbered from 1 to n. Each course has some duration(course length) t and closed on dth day. A course should be ta 阅读全文
posted @ 2018-11-30 15:19
bernieloveslife
阅读(171)
评论(0)
推荐(0)
摘要:
Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Out 阅读全文
posted @ 2018-11-30 15:19
bernieloveslife
阅读(91)
评论(0)
推荐(0)
摘要:
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
posted @ 2018-11-30 15:19
bernieloveslife
阅读(94)
评论(0)
推荐(0)
摘要:
Given a non empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti 阅读全文
posted @ 2018-11-30 15:19
bernieloveslife
阅读(99)
评论(0)
推荐(0)
摘要:
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(94)
评论(0)
推荐(0)
摘要:
Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: I 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(76)
评论(0)
推荐(0)
摘要:
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 A 2 B 3 C ... 26 Z 27 AA 28 AB ... Example 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(84)
评论(0)
推荐(0)
摘要:
Given an input string, reverse the string word by word. Example: Input: "the sky is blue", Output: "blue is sky the". Note: A word is defined as a seq 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(91)
评论(0)
推荐(0)
摘要:
Convert a non negative integer to its english words representation. Given input is guaranteed to be less than 231 1. Example 1: Input: 123 Output: "On 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(90)
评论(0)
推荐(0)
摘要:
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? No extra space solution: 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(80)
评论(0)
推荐(0)
摘要:
Reverse a singly linked list. Example: Input: 1 2 3 4 5 NULL Output: 5 4 3 2 1 NULL Follow up: A linked list can be reversed either iteratively or rec 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(73)
评论(0)
推荐(0)
摘要:
Given a linked list, rotate the list to the right by k places, where k is non negative. Example 1: Input: 1 2 3 4 5 NULL, k = 2 Output: 4 5 1 2 3 NULL 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(79)
评论(0)
推荐(0)
摘要:
Given an absolute path for a file (Unix style), simplify it. For example, path = "/home/", = "/home" path = "/a/./b/../../c/", = "/c" path = "/a/../.. 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(102)
评论(0)
推荐(0)
摘要:
Let's call an array A a mountain if the following properties hold: A.length = 3 There exists some 0 A[i+1] ... A[A.length 1] Given an array that is de 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(97)
评论(0)
推荐(0)
摘要:
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul 阅读全文
posted @ 2018-11-30 15:18
bernieloveslife
阅读(125)
评论(0)
推荐(0)
摘要:
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]). F 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(100)
评论(0)
推荐(0)
摘要:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) Push element x onto stack. pop() Removes the 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(96)
评论(0)
推荐(0)
摘要:
Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? Example: Input: 3 Output: 5 Explanation: Given n = 3, the 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(107)
评论(0)
推荐(0)
摘要:
Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] Follow up: Recursive so 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(65)
评论(0)
推荐(0)
摘要:
Example 1: Given the following tree [3,9,20,null,null,15,7]: Return true. Example 2: Given the following tree [1,2,2,3,3,null,null,4,4]: Return false. 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(91)
评论(0)
推荐(0)
摘要:
SQL Schema There is a table World + + + + + + | name | continent | area | population | gdp | + + + + + + | Afghanistan | Asia | 652230 | 25500100 | 20 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(95)
评论(0)
推荐(0)
摘要:
Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other wo 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(115)
评论(0)
推荐(0)
摘要:
Given an array nums and a value val, remove all instances of that value in place and return the new length. Do not allocate extra space for another ar 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(94)
评论(0)
推荐(0)
摘要:
Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202" Example 2: Input: 7 Output: " 10" Note: The input will 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(90)
评论(0)
推荐(0)
摘要:
Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(86)
评论(0)
推荐(0)
摘要:
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Example 1: Input: 11 Out 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(83)
评论(0)
推荐(0)
摘要:
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]). F 阅读全文
posted @ 2018-11-30 15:17
bernieloveslife
阅读(108)
评论(0)
推荐(0)
摘要:
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 cl 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(98)
评论(0)
推荐(0)
摘要:
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(89)
评论(0)
推荐(0)
摘要:
Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input: "A man, a p 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(75)
评论(0)
推荐(0)
摘要:
You have a total of n coins that you want to form in a staircase shape, where every k th row must have exactly k coins. Given n, find the total number 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(95)
评论(0)
推荐(0)
摘要:
We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(119)
评论(0)
推荐(0)
摘要:
Given a binary tree, return all root to leaf paths. Note: A leaf is a node with no children. Example: Input: Output: ["1 2 5", "1 3"] Explanation: All 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(361)
评论(0)
推荐(0)
摘要:
Given a binary tree and a sum, determine if the tree has a root to leaf path such that adding up all the values along the path equals the given sum. N 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(95)
评论(0)
推荐(0)
摘要:
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(71)
评论(0)
推荐(0)
摘要:
Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Retu 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(100)
评论(0)
推荐(0)
摘要:
Given a C++ program, remove comments from it. The program source is an array where source[i] is the i th line of the source code. This represents the 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(127)
评论(0)
推荐(0)
摘要:
Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(122)
评论(0)
推荐(0)
摘要:
Given a non negative integer numRows, generate the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(111)
评论(0)
推荐(0)
摘要:
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 阅读全文
posted @ 2018-11-30 15:16
bernieloveslife
阅读(81)
评论(0)
推荐(0)
摘要:
Alice and Bob have candy bars of different sizes: A[i] is the size of the i th bar of candy that Alice has, and B[j] is the size of the j th bar of ca 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(208)
评论(0)
推荐(0)
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(110)
评论(0)
推荐(0)
摘要:
Implement strStr(). Return the index of the first occurrence of needle in haystack, or 1 if needle is not part of haystack. Example 1: Input: haystack 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(116)
评论(0)
推荐(0)
摘要:
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Exampl 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(71)
评论(0)
推荐(0)
摘要:
Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1 2 Output: false Example 2: Input: 1 2 2 1 Output: true Follow up: Cou 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(101)
评论(0)
推荐(0)
摘要:
Given a non negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note that the row index starts from 0. In Pascal's trian 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(178)
评论(0)
推荐(0)
摘要:
We have an array A of non negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(332)
评论(0)
推荐(0)
摘要:
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is written as II in Roman numeral, just two one's 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(99)
评论(0)
推荐(0)
摘要:
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(97)
评论(0)
推荐(0)
摘要:
Given a string containing digits from 2 9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to le 阅读全文
posted @ 2018-11-30 15:15
bernieloveslife
阅读(176)
评论(0)
推荐(0)
摘要:
You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' id. 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(150)
评论(0)
推荐(0)
摘要:
Given a tree, rearrange the tree in in order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and o 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(129)
评论(0)
推荐(0)
摘要:
An array is monotonic if it is either monotone increasing or monotone decreasing. An array A is monotone increasing if for all i = A[j]. Return true i 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(92)
评论(0)
推荐(0)
摘要:
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(93)
评论(0)
推荐(0)
摘要:
We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists only of lowercase letters.) A word is uncommo 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(174)
评论(0)
推荐(0)
摘要:
Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Input: [1,3,null,null,2 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(129)
评论(0)
推荐(0)
摘要:
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(82)
评论(0)
推荐(0)
摘要:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height balanced binary tree is d 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(121)
评论(0)
推荐(0)
摘要:
Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(91)
评论(0)
推荐(0)
摘要:
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(80)
评论(0)
推荐(0)
摘要:
Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. For example, in the given t 阅读全文
posted @ 2018-11-30 15:14
bernieloveslife
阅读(120)
评论(0)
推荐(0)
摘要:
Given a binary tree struct TreeLinkNode { TreeLinkNode left; TreeLinkNode right; TreeLinkNode next; } Populate each next pointer to point to its next 阅读全文
posted @ 2018-11-30 15:13
bernieloveslife
阅读(123)
评论(0)
推荐(0)
摘要:
Given a binary tree struct TreeLinkNode { TreeLinkNode left; TreeLinkNode right; TreeLinkNode next; } Populate each next pointer to point to its next 阅读全文
posted @ 2018-11-30 15:13
bernieloveslife
阅读(108)
评论(0)
推荐(0)
摘要:
Given a binary tree, flatten it to a linked list in place. For example, given the following tree: The flattened tree should look like: 阅读全文
posted @ 2018-11-30 15:13
bernieloveslife
阅读(75)
评论(0)
推荐(0)
摘要:
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2018-11-30 15:13
bernieloveslife
阅读(93)
评论(0)
推荐(0)
摘要:
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 example 阅读全文
posted @ 2018-11-30 15:13
bernieloveslife
阅读(117)
评论(0)
推荐(0)

浙公网安备 33010602011771号