01 2021 档案
摘要:Given a matrix of integers A with R rows and C columns, find the maximum score of a path starting at [0,0] and ending at [R-1,C-1]. The score of a pat
阅读全文
摘要:You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the heigh
阅读全文
摘要:Given a root of an N-ary tree, you need to compute the length of the diameter of the tree. The diameter of an N-ary tree is the length of the longest
阅读全文
摘要:A company has n employees with a unique ID for each employee from 0 to n - 1. The head of the company has is the one with headID. Each employee has on
阅读全文
摘要:The numeric value of a lowercase character is defined as its position (1-indexed) in the alphabet, so the numeric value of a is 1, the numeric value o
阅读全文
摘要:Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once. 24-hour times are formatted as "HH:MM", w
阅读全文
摘要:Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a==c and b==d), or (a==d and b==c) - that
阅读全文
摘要:Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters. F
阅读全文
摘要:A cinema has n rows of seats, numbered from 1 to n and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above. Given the
阅读全文
摘要:You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum
阅读全文
摘要:We have an array A of integers, and an array queries of queries. For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[index]
阅读全文
摘要:Given two integers a and b, return any string s such that: s has length a + b and contains exactly a 'a' letters, and exactly b 'b' letters, The subst
阅读全文
摘要:A string s is called happy if it satisfies the following conditions: s only contains the letters 'a', 'b', and 'c'. s does not contain any of "aaa", "
阅读全文
摘要:You are given an integer n. An array nums of length n + 1 is generated in the following way: nums[0] = 0 nums[1] = 1 nums[2 * i] = nums[i] when 2 <= 2
阅读全文
摘要:A string of '0's and '1's is monotone increasing if it consists of some number of '0's (possibly 0), followed by some number of '1's (also possibly 0.
阅读全文
摘要:You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array num
阅读全文
摘要:Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binary number (from most-significant-bit to least-si
阅读全文
摘要:You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characte
阅读全文
摘要:Given an array of integers arr and an integer k. A value arr[i] is said to be stronger than a value arr[j] if |arr[i] - m| > |arr[j] - m| where m is t
阅读全文
摘要:二分法是算法题里面一个比较基础但是很容易错的概念,一开始练习的时候由于不熟悉二分法的套路,反复出现死循环或者目标值找错,非常影响做题心情。我总结了如下几个模板。原则上这里的模板无论你使用哪一个,都可以解决二分法类型的问题,只不过有一些题目,比如寻找一个最大值/最小值的,可能某一个模板更适合,需要判断
阅读全文
摘要:Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Input: c = 5 Output: true Explanation:
阅读全文
摘要:You are given an array of positive integers nums and want to erase a subarray containing unique elements. The score you get by erasing the subarray is
阅读全文
摘要:Given a string s, return the maximum number of unique substrings that the given string can be split into. You can split string s into any list of non-
阅读全文
摘要:You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equa
阅读全文
摘要:Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's. Example 1: Input:
阅读全文
摘要:Given a binary array, find the maximum number of consecutive 1s in this array if you can flip at most one 0. Example 1: Input: [1,0,1,1,0] Output: 4 E
阅读全文
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di
阅读全文
摘要:In a string s of lowercase letters, these letters form consecutive groups of the same character. For example, a string like s = "abbxxxxzyy" has the g
阅读全文
摘要:Suppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every
阅读全文
摘要:You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerB
阅读全文
摘要:You are given an integer array nums and an integer k. In one operation, you can pick two numbers from the array whose sum equals k and remove them fro
阅读全文
摘要:Given an array of positive integers target and an array initial of same size with all zeros. Return the minimum number of operations to form a target
阅读全文
摘要:Given two binary trees original and cloned and given a reference to a node target in the original tree. The cloned tree is a copy of the original tree
阅读全文
摘要:You are given an integer array nums with no duplicates. A maximum binary tree can be built recursively from nums using the following algorithm: Create
阅读全文
摘要:You are given an array of distinct integers arr and an array of integer arrays pieces, where the integers in pieces are distinct. Your goal is to form
阅读全文

浙公网安备 33010602011771号