06 2020 档案
摘要:You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct th
阅读全文
摘要:Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is an integer that is the square of an integer;
阅读全文
摘要:There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. Given the array groupSizes of length n telling the group
阅读全文
摘要:Given an integer array nums which is sorted in ascending order and all of its elements are unique and given also an integer k, return the kth missing
阅读全文
摘要:Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all
阅读全文
摘要:Given two version strings, version1 and version2, compare them. A version string consists of revisions separated by dots '.'. The value of the revisio
阅读全文
摘要:Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the
阅读全文
摘要:Given the root of a binary tree, return the average value of the nodes on each level in the form of an array. Answers within 10-5 of the actual answer
阅读全文
摘要:Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of wa
阅读全文
摘要:Given an array of strings names of size n. You will create n folders in your file system such that, at the ith minute, you will create a folder with t
阅读全文
摘要:Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Return the quotient after dividi
阅读全文
摘要:The set [1, 2, 3, ..., n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, we get the following s
阅读全文
摘要:Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur 2 or more times. (The occurrences may overlap.) Return a
阅读全文
摘要:Given an array of citations sorted in ascending order (each citation is a non-negative integer) of a researcher, write a function to compute the resea
阅读全文
摘要:We run a preorder depth first search on the root of a binary tree. At each node in this traversal, we output D dashes (where D is the depth of this no
阅读全文
摘要:You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance
阅读全文
摘要:Given a string queryIP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of an
阅读全文
摘要:You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It
阅读全文
摘要:Given a sorted array arr, 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
阅读全文
摘要:There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is
阅读全文
摘要:Given an integer array arr and a target value target, return the integer value such that when we change all the integers larger than value in the give
阅读全文
摘要:Given a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subse
阅读全文
摘要:RandomizedCollection is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting an
阅读全文
摘要:You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may
阅读全文
摘要:Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order
阅读全文
摘要:Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfie
阅读全文
摘要:Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as http
阅读全文
摘要:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t
阅读全文
摘要:Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is s
阅读全文
摘要:Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from t
阅读全文
摘要:The i-th person has weight people[i], and each boat can carry a maximum weight of limit. Each boat carries at most 2 people at the same time, provided
阅读全文
摘要:At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bil
阅读全文
摘要:给定一个数字,我们按照如下规则把它翻译为字符串:0 翻译成 “a” ,1 翻译成 “b”,……,11 翻译成 “l”,……,25 翻译成 “z”。一个数字可能有多个翻译。请编程实现一个函数,用来计算一个数字有多少种不同的翻译方法。 示例 1: 输入: 12258输出: 5解释: 12258有5种不同
阅读全文
摘要:You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that a
阅读全文
摘要:You have an array of logs. Each log is a space delimited string of words. For each log, the first word in each log is an alphanumeric identifier. Then
阅读全文
摘要:The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the
阅读全文
摘要:Given an array equations of strings that represent relationships between variables, each string equations[i] has length 4 and takes one of two differe
阅读全文
摘要:You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] rep
阅读全文
摘要:You are given an array of positive integers w where w[i] describes the weight of ith index (0-indexed). We need to call the function pickIndex() which
阅读全文
摘要:Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output:
阅读全文
摘要:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. E
阅读全文
摘要:A company is planning to interview 2n people. Given the array costs where costs[i] = [aCosti, bCosti], the cost of flying the ith person to city a is
阅读全文
摘要:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where: '?' Matches any single character.
阅读全文
摘要:There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an
阅读全文

浙公网安备 33010602011771号