07 2020 档案
摘要:You are given two integer arrays nums1 and nums2 sorted in non-decreasing order and an integer k. Define a pair (u, v) which consists of one element f
阅读全文
摘要:Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum. The
阅读全文
摘要:Given an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers. Return the maximum product
阅读全文
摘要:There is a ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through the empty spaces by rolling up, d
阅读全文
摘要:There is a ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through the empty spaces by rolling up, d
阅读全文
摘要:There is a ball in a maze with empty spaces (represented as 0) and walls (represented as 1). The ball can go through the empty spaces by rolling up, d
阅读全文
摘要:We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to t
阅读全文
摘要:Given the edges of a directed graph, and two nodes source and destination of this graph, determine whether or not all paths starting from source event
阅读全文
摘要:Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1, and return them in any ord
阅读全文
摘要:Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list. Examp
阅读全文
摘要:Let's play the minesweeper game (Wikipedia, online game)! You are given an m x n char matrix board representing the game board where: 'M' represents a
阅读全文
摘要:You are controlling a robot that is located somewhere in a room. The room is modeled as an m x n binary grid where 0 represents a wall and 1 represent
阅读全文
摘要:There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges
阅读全文
摘要:Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: le
阅读全文
摘要:Given a string s, return the number of substrings that have only one distinct letter. Example 1: Input: s = "aaaba" Output: 8 Explanation: The substri
阅读全文
摘要:Given a string s and an integer k, return the number of substrings in s of length k with no repeated characters. Example 1: Input: s = "havefunonleetc
阅读全文
摘要: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 burst all the balloon
阅读全文
摘要:Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be
阅读全文
摘要:Given an integer array nums and an integer k, return the maximum length of a subarray that sums to k. If there is not one, return 0 instead. Example 1
阅读全文
摘要:You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where f
阅读全文
摘要:Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right
阅读全文
摘要:A valid number can be split up into these components (in order): A decimal number or an integer. (Optional) An 'e' or 'E', followed by an integer. A d
阅读全文
摘要:There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array
阅读全文
摘要:Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand. Example 1: Input: hour = 12, m
阅读全文
摘要:Given a binary string s, return the number of substrings with all characters 1's. Since the answer may be too large, return it modulo 109 + 7. Example
阅读全文
摘要:Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. Example 1: Input: nums
阅读全文
摘要:Given a binary tree struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next right node. If there
阅读全文
摘要:You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following defin
阅读全文
摘要:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a
阅读全文
摘要:Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and op
阅读全文
摘要:Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the num
阅读全文
摘要:You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional child pointer. This child poi
阅读全文
摘要:You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that th
阅读全文
摘要:Given the root of a binary tree, return the maximum width of the given tree. The maximum width of a tree is the maximum width among all levels. The wi
阅读全文
摘要:Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be
阅读全文
摘要:Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible str
阅读全文
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. A palindro
阅读全文
摘要:Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possib
阅读全文
摘要:你正在使用一堆木板建造跳水板。有两种类型的木板,其中长度较短的木板长度为shorter,长度较长的木板长度为longer。你必须正好使用k块木板。编写一个方法,生成跳水板所有可能的长度。 返回的长度需要从小到大排列。 示例: 输入:shorter = 1longer = 2k = 3输出: {3,4
阅读全文
摘要: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
阅读全文
摘要:We have a wooden plank of the length n units. Some ants are walking on the plank, each ant moves with speed 1 unit per second. Some of the ants move t
阅读全文
摘要:Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list
阅读全文
摘要:The count-and-say sequence is a sequence of digit strings defined by the recursive formula: countAndSay(1) = "1" countAndSay(n) is the way you would "
阅读全文
摘要:There are 8 prison cells in a row, and each cell is either occupied or vacant. Each day, whether the cell is occupied or vacant changes according to t
阅读全文
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Example 1: Input:
阅读全文
摘要:Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More forma
阅读全文
摘要:You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last
阅读全文
摘要:Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequent
阅读全文
摘要:Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence o
阅读全文
摘要:Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Example 1: Input: nums1 = [1,2,3,2,1],
阅读全文

浙公网安备 33010602011771号