05 2020 档案
摘要:Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1,
阅读全文
摘要:Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n]. You may return the answer in any order. Exampl
阅读全文
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb
阅读全文
摘要:Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen nu
阅读全文
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are ar
阅读全文
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo
阅读全文
摘要:Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation o
阅读全文
摘要:Given an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition
阅读全文
摘要:We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not
阅读全文
摘要:Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is be
阅读全文
摘要:Every email consists of a local name and a domain name, separated by the @ sign. For example, in alice@leetcode.com, alice is the local name, and leet
阅读全文
摘要:Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k. A subarray is a contiguous part
阅读全文
摘要:Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its ro
阅读全文
摘要:You have intercepted a secret message encoded as a string of numbers. The message is decoded via the following mapping: "1" -> 'A' "2" -> 'B' ... "25"
阅读全文
摘要:Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the
阅读全文
摘要:Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1]
阅读全文
摘要:Given a string num that contains only digits and an integer target, return all possibilities to add the binary operators '+', '-', or '*' between the
阅读全文
摘要:Design an algorithm that collects daily price quotes for some stock and returns the span of that stock's price for the current day. The span of the st
阅读全文
摘要:Given the string s, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must
阅读全文
摘要:Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1's permutatio
阅读全文
摘要:Given an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the answer wil
阅读全文
摘要:Given the array favoriteCompanies where favoriteCompanies[i] is the list of favorites companies for the ith person (indexed from 0). Return the indice
阅读全文
摘要:Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators a
阅读全文
摘要:Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or
阅读全文
摘要:Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, and /. Each operand may be an integer or anoth
阅读全文
摘要:Given a circular integer array nums of length n, return the maximum possible sum of a non-empty subarray of nums. A circular array means the end of th
阅读全文
摘要:Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at
阅读全文
摘要:Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration whe
阅读全文
摘要:In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some perm
阅读全文
摘要:Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: Input: matri
阅读全文
摘要:Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle. In Pascal's triangle, each number is the sum of the two num
阅读全文
摘要:Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly abov
阅读全文
摘要:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating
阅读全文
摘要:Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num. Exa
阅读全文
摘要:You are given an inclusive range [lower, upper] and a sorted unique integer array nums, where all elements are in the inclusive range. A number x is c
阅读全文
摘要:You are given a sorted unique integer array nums. A range [a,b] is the set of all integers from a to b (inclusive). Return the smallest sorted list of
阅读全文
摘要:Given the root of a binary tree, calculate the vertical order traversal of the binary tree. For each node at position (row, col), its left and right c
阅读全文
摘要:Given the root of a binary tree, return the vertical order traversal of its nodes' values. (i.e., from top to bottom, column by column). If two nodes
阅读全文
摘要:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequ
阅读全文
摘要:You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.
阅读全文
摘要:Given an undirected tree consisting of n vertices numbered from 0 to n-1, which has some apples in their vertices. You spend 1 second to walk over one
阅读全文
摘要:Given an array of integers arr. We want to select three indices i, j and k where (0 <= i < j <= k < arr.length). Let's define a and b as follows: a =
阅读全文
摘要:You are given an integer array target and an integer n. You have an empty stack with the two following operations: "Push": pushes an integer to the to
阅读全文
摘要:Suppose you are at a party with n people labeled from 0 to n - 1 and among them, there may exist one celebrity. The definition of a celebrity is that
阅读全文
摘要:In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. If the town judge exists, the
阅读全文
摘要:You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight
阅读全文
摘要:Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single character. '
阅读全文
摘要:There are n servers numbered from 0 to n-1 connected by undirected server-to-server connections forming a network where connections[i] = [a, b] repres
阅读全文
摘要:You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. Grid cells are connected hor
阅读全文
摘要:Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any position
阅读全文
摘要:Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle
阅读全文
摘要:A website domain "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com" and
阅读全文
摘要:Given the root of a binary tree with unique values and the values of two different nodes of the tree x and y, return true if the nodes corresponding t
阅读全文
摘要:Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating c
阅读全文
摘要:Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in
阅读全文
摘要:Given an integer array nums of length n where all the integers of nums are in the range [1, n] and each integer appears once or twice, return an array
阅读全文
摘要:Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity shou
阅读全文
摘要:In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given
阅读全文
摘要:You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return
阅读全文
摘要:We can shift a string by shifting each of its letters to its successive letter. For example, "abc" can be shifted to be "bcd". We can keep shifting th
阅读全文
摘要:Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11 as "1011" in binary, and so on. Not
阅读全文
摘要:Given a positive integer num, output its complement number. The complement strategy is to flip the bits of its binary representation. Example 1: Input
阅读全文
摘要:Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of the graph. Each node in the graph contains a value (int) an
阅读全文
摘要:You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of ston
阅读全文
摘要:Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after
阅读全文
摘要:In an infinite chess board with coordinates from -infinity to +infinity, you have a knight at square [0, 0]. A knight has 8 possible moves it can make
阅读全文
摘要:You are given an m x n grid rooms initialized with these three possible values. -1 A wall or an obstacle. 0 A gate. INF Infinity means an empty room.
阅读全文
摘要:You are given an m x n matrix board containing letters 'X' and 'O', capture regions that are surrounded: Connect: A cell is connected to adjacent cell
阅读全文
摘要:Given an array of unique integers preorder, return true if it is the correct preorder traversal sequence of a binary search tree. Example 1: Input: pr
阅读全文
摘要:Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at leas
阅读全文
摘要:Given the root of a binary tree, turn the tree upside down and return the new root. You can turn a binary tree upside down with the following steps: T
阅读全文
摘要:A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading z
阅读全文
摘要:Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to positi
阅读全文
摘要:Given a string s, return true if the s can be palindrome after deleting at most one character from it. Example 1: Input: s = "aba" Output: true Exampl
阅读全文
摘要:Given a binary tree where each path going from the root to any leaf form a valid sequence, check if a given string is a valid sequence in such binary
阅读全文

浙公网安备 33010602011771号