07 2020 档案
摘要:Word Break II (H) 题目 Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentenc
阅读全文
摘要:Best Time to Buy and Sell Stock with Cooldown (M) 题目 Say you have an array for which the ith element is the price of a given stock on day i. Design an
阅读全文
摘要:Task Scheduler (M) 题目 You are given a char array representing tasks CPU need to do. It contains capital letters A to Z where each letter represents a
阅读全文
摘要:Construct Binary Tree from Inorder and Postorder Traversal (M) 题目 Given inorder and postorder traversal of a tree, construct the binary tree. Note: Yo
阅读全文
摘要:Add Digits (E) 题目 Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Ex
阅读全文
摘要:Find Minimum in Rotated Sorted Array II (H) 题目 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [
阅读全文
摘要:All Paths From Source to Target (M) 题目 Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in
阅读全文
摘要:Single Number III (M) 题目 Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twic
阅读全文
摘要:Edit Distance (H) 题目 Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following
阅读全文
摘要:Binary Tree Zigzag Level Order Traversal (M) 题目 Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to r
阅读全文
摘要:Burst Balloons (H) 题目 Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to
阅读全文
摘要:Word Search (M) 题目 Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent
阅读全文
摘要:Add Binary (E) 题目 Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters
阅读全文
摘要:Remove Linked List Elements (E) 题目 Remove all elements from a linked list of integers that have value val. Example: Input: 1->2->6->3->4->5->6, val =
阅读全文
摘要:Course Schedule II (M) 题目 There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to
阅读全文
摘要:Binary Watch (E) 题目 A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).
阅读全文
摘要:Find Right Interval (M) 题目 Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than
阅读全文
摘要:Reverse Words in a String (M) 题目 Given an input string, reverse the string word by word. Example 1: Input: "the sky is blue" Output: "blue is sky the"
阅读全文
摘要:Angle Between Hands of a Clock (M) 题目 Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minut
阅读全文
摘要:Non-overlapping Intervals (M) 题目 Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the inte
阅读全文
摘要:Number of Segments in a String (E) 题目 Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space ch
阅读全文
摘要:Unique Paths II (M) 题目 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either
阅读全文
摘要:Unique Paths (M) 题目 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either do
阅读全文
摘要:Same Tree (E) 题目 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 s
阅读全文
摘要:Reverse Bits (E) 题目 Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 001110010111100000101
阅读全文
摘要:Subsets (M) 题目 Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate
阅读全文
摘要:Rotate List (M) 题目 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 =
阅读全文
摘要:Flatten a Multilevel Doubly Linked List (M) 题目 You are given a doubly linked list which in addition to the next and previous pointers, it could have a
阅读全文
摘要:Maximum Width of Binary Tree (M) 题目 Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maxim
阅读全文
摘要:Island Perimeter (E) 题目 You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are c
阅读全文
摘要:Additive Number (M) 题目 Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three nu
阅读全文
摘要:Permutation Sequence (M) 题目 The set [1,2,3,...,*n*] contains a total of n! unique permutations. By listing and labeling all of the permutations in ord
阅读全文
摘要:Plus One (E) 题目 Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the mo
阅读全文
摘要:Spiral Matrix II (M) 题目 Given a positive integer n, generate a square matrix filled with elements from 1 to \(n^2\) in spiral order. Example: Input: 3
阅读全文
摘要:Length of Last Word (E) 题目 Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in t
阅读全文
摘要:Hamming Distance (E) 题目 The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two
阅读全文
摘要:Valid Perfect Square (E) 题目 Given a positive integer num, write a function which returns True if num is a perfect square else False. Follow up: Do not
阅读全文
摘要:Insert Interval (H) 题目 Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that th
阅读全文
摘要:Ugly Number II (M) 题目 Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Exampl
阅读全文
摘要:Merge Intervals (M) 题目 Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6]
阅读全文
摘要:Jump Game (M) 题目 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array repr
阅读全文
摘要:Prison Cells After N Days (M) 题目 There are 8 prison cells in a row, and each cell is either occupied or vacant. Each day, whether the cell is occupied
阅读全文
摘要:Spiral Matrix (M) 题目 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input: [ [ 1,
阅读全文
摘要:Maximum Subarray (E) 题目 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and retur
阅读全文
摘要:Binary Tree Level Order Traversal II (E) 题目 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to ri
阅读全文
摘要:N-Queens II (H) 题目 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an int
阅读全文
摘要:N-Queens (H) 题目 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an intege
阅读全文
摘要:Arranging Coins (E) 题目 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
阅读全文
摘要:Odd Even Linked List (M) 题目 Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about
阅读全文
摘要:Counting Bits (M) 题目 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary
阅读全文
摘要:Top K Frequent Elements (M) 题目 Given a non-empty array of integers, return the *k* most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k =
阅读全文
摘要:Pow(x, n) (M) 题目 mplement pow(x, n), which calculates x raised to the power n (\(x^n\)). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: I
阅读全文
摘要:Group Anagrams (M) 题目 Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate"
阅读全文
摘要:Rotate Image (M) 题目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the i
阅读全文

浙公网安备 33010602011771号