自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(165)
  • 问答 (1)
  • 收藏
  • 关注

原创 leetcode 1074. Number of Submatrices That Sum to Target

Given amatrix, and atarget, return the number of non-empty submatrices that sum totarget.A submatrixx1, y1, x2, y2is the set of all cellsmatrix[x][y]withx1 <= x <= x2andy1 <= y &l...

2019-11-05 17:35:00 193

原创 leetcode 928. Minimize Malware Spread II

(This problem is the same asMinimize Malware Spread, with the differences bolded.)In a network of nodes, each nodeiis directly connected to another nodejif and only ifgraph[i][j] = 1.Some no...

2019-11-05 16:00:09 253

原创 leetcode 568. Maximum Vacation Days

LeetCode wants to give one of its best employees the option to travel amongNcities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some par...

2019-10-30 09:31:46 190

原创 leetcode 210. Course Schedule II

There are a total ofncourses you have to take, labeled from0ton-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair...

2019-10-11 11:21:21 107

原创 leetcode 1168. Optimize Water Distribution in a Village

There arenhouses in a village. We want to supply water for all the houses by building wells and laying pipes.For each housei, we can either build a well inside it directly with costwells[i], or ...

2019-10-11 10:21:45 454

原创 leetcode 1088. Confusing Number II

We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. When 2, 3, 4, 5 and 7 are rotated 180 degrees, they become i...

2019-10-10 14:43:30 9830

原创 leetcode 340. Longest Substring with At Most K Distinct Characters

Given a string, find the length of the longest substring T that contains at most k distinct characters.Example 1:Input: s = "eceba", k = 2Output: 3Explanation: T is "ece" which its length is 3....

2019-10-03 16:09:57 101

原创 leetcode 158. Read N Characters Given Read4 II - Call multiple times

Given a file and assume that you can only read the file using a given methodread4, implement a method read to read n characters. Your method read may be called multiple times.Method read4: The...

2019-10-02 18:46:42 202

原创 leetcode 269. Alien Dictionary

There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of non-empty words from the dictionary, where words are sorted lexi...

2019-10-02 16:32:03 210

原创 leetcode 772. Basic Calculator III

Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty sp...

2019-10-02 09:33:58 161

原创 leetcode 308. Range Sum Query 2D - Mutable

Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).The above rectangle (with the red borde...

2019-09-30 10:03:35 113

原创 leetcode 159. Longest Substring with At Most Two Distinct Characters

Given a string s , find the length of the longest substringtthat contains at most 2 distinct characters.Example 1:Input: "eceba"Output: 3Explanation: t is "ece" which its length is 3.Exam...

2019-09-30 09:10:28 97

原创 leetcode 972. Equal Rational Numbers

Given two stringsSandT, each of which represents a non-negative rational number, returnTrueif and only if they represent the same number. The strings may use parentheses to denote the repeating p...

2019-09-27 10:49:53 173

原创 leetcode 1192. Critical Connections in a Network

There aren servers numbered from0ton-1 connected byundirected server-to-server connections forming a network where connections[i] = [a, b]represents a connection between servers aand b. Any ser...

2019-09-26 14:35:31 754

原创 1163. Last Substring in Lexicographical Order

Given a string s, return the last substring of s in lexicographical order.Example 1:Input: "abab"Output: "bab"Explanation: The substrings are ["a", "ab", "aba", "abab", "b", "ba", "bab"]. Th...

2019-09-25 11:07:32 432

原创 leetcode 1157. Online Majority Element In Subarray

Implementing the class MajorityChecker, which has the following API:MajorityChecker(int[] arr) constructs an instance of MajorityChecker with the given array arr; int query(int left, int right, int...

2019-09-25 08:41:07 139

原创 leetcode 1106. Parsing A Boolean Expression

Return the result of evaluating a given boolean expression, represented as a string.An expression can either be:"t", evaluating to True; "f", evaluating to False; "!(expr)", evaluating to the lo...

2019-09-24 09:43:13 254

原创 leetcode 1096. Brace Expansion II

Under a grammar given below, strings can represent a set of lowercase words. Let'suse R(expr)to denote the set of words the expression represents.Grammar can best be understood through simple exa...

2019-09-23 21:08:33 1162

原创 leetcode 1095. Find in Mountain Array

(This problem is aninteractive problem.)You may recall that an arrayAis amountain arrayif and only if:A.length >= 3 There exists someiwith0 < i< A.length - 1such that: A[0] &l...

2019-09-23 15:09:03 141

原创 leetcode 1044. Longest Duplicate Substring

Given a stringS, consider allduplicated substrings: (contiguous) substrings of S that occur 2 or more times. (The occurrencesmay overlap.)Returnanyduplicatedsubstring that has the longest pos...

2019-09-22 11:23:08 263

原创 leetcode 1036. Escape a Large Maze

In a 1 million by 1 million grid, the coordinates of each grid square are(x, y)with0 <= x, y < 10^6.We start at thesourcesquare and want to reach thetargetsquare. Each move, we can wal...

2019-09-21 17:01:12 183

原创 leetcode 1032. Stream of Characters

Implement the StreamChecker class as follows:StreamChecker(words): Constructor, init the data structure with the given words. query(letter): returns true if and only if for some k >= 1, the last...

2019-09-20 14:23:02 109

原创 leeetcode 1001. Grid Illumination

On a N x N grid of cells, each cell (x, y) with 0 <= x < N and 0 <= y < N has a lamp.Initially, some number of lamps are on. lamps[i] tells us the location of the i-th lamp that is on....

2019-09-18 19:08:58 129

原创 leetcode 982. Triples with Bitwise AND Equal To Zero

Given an array of integersA, find the number oftriples of indices (i, j, k)such that:0 <= i < A.length 0 <= j < A.length 0 <= k < A.length A[i]& A[j]& A[k] == 0, wh...

2019-09-18 11:21:21 128

原创 leetcode 924. Minimize Malware Spread

In a network of nodes, each nodeiis directly connected to another nodejif and only ifgraph[i][j] = 1.Some nodesinitialare initially infected by malware. Whenever two nodes are directly conne...

2019-09-18 10:43:07 139

原创 leetcode 913. Cat and Mouse

A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns.The graph is given as follows: graph[a] is a list of all nodes b such that ab is an edge of the graph.Mou...

2019-09-17 17:18:03 162

原创 leetcode 906. Super Palindromes

Let's say a positive integer is asuperpalindromeif it is a palindrome, and it is also the square of a palindrome.Now, given two positiveintegers L and R (represented as strings), return the numbe...

2019-09-17 11:12:05 127

原创 leetcode 899. Orderly Queue

A string S of lowercase letters is given. Then, we may make any number of moves.In each move, wechoose oneof the first K letters (starting from the left), remove it,and place it at the end of th...

2019-09-16 12:01:32 194

原创 leetcode 895. Maximum Frequency Stack

Implement FreqStack, a class which simulates the operation of a stack-like data structure.FreqStackhas two functions:push(int x), which pushes an integer x onto the stack. pop(), which removes a...

2019-09-16 11:12:52 89

原创 leetcode 891. Sum of Subsequence Widths

Given an array of integers A, consider all non-empty subsequences of A.For any sequence S, let thewidthof S be the difference between the maximum and minimum element of S.Return the sum of the w...

2019-09-15 20:28:47 140

原创 leetcode 1028. Recover a Tree From Preorder Traversal

We run apreorderdepth 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 node), then we output the value of this node.(If ...

2019-09-11 10:01:28 90

原创 leetcode 1187. Make Array Strictly Increasing

Given two integer arraysarr1 and arr2, return the minimum number of operations (possibly zero) neededto make arr1 strictly increasing.In one operation, you can choose two indices0 <=i < ar...

2019-09-09 19:36:37 465

原创 leetcode 1147. Longest Chunked Palindrome Decomposition

Return the largest possible ksuch that there existsa_1, a_2, ..., a_ksuch that:Each a_i is a non-empty string; Their concatenation a_1 + a_2 + ... + a_k is equal to text; For all 1 <= i <...

2019-09-09 16:02:40 152

原创 leetcode 1125. Smallest Sufficient Team

In a project, you have a list of required skills req_skills,and a list of people. The i-th person people[i]contains a list of skills that person has.Consider a sufficient team: a set of people su...

2019-09-09 15:39:17 248

原创 leetcode 1092. 最短公共超序列

给出两个字符串 str1 和 str2,返回同时以 str1 和 str2 作为子序列的最短字符串。如果答案不止一个,则可以返回满足条件的任意一个答案。(如果从字符串 T 中删除一些字符(也可能不删除,并且选出的这些字符可以位于 T 中的 任意位置),可以得到字符串 S,那么 S 就是 T 的子序列)示例:输入:str1 = "abac", str2 = "cab"输出:"ca...

2019-09-07 11:59:57 1859 1

原创 leetcode 1074. 元素和为目标值的子矩阵数量

给出矩阵 matrix 和目标值 target,返回元素总和等于目标值的非空子矩阵的数量。子矩阵 x1, y1, x2, y2 是满足 x1 <= x <= x2 且 y1 <= y <= y2 的所有单元 matrix[x][y] 的集合。如果 (x1, y1, x2, y2) 和 (x1', y1', x2', y2') 两个子矩阵中部分坐标不同(如:x1 !=...

2019-09-07 10:04:05 432

原创 leetcode 1012. 至少有 1 位重复的数字

给定正整数 N,返回小于等于 N 且具有至少 1 位重复数字的正整数。示例 1:输入:20输出:1解释:具有至少 1 位重复数字的正数(<= 20)只有 11 。示例 2:输入:100输出:10解释:具有至少 1 位重复数字的正数(<= 100)有 11,22,33,44,55,66,77,88,99 和 100 。示例 3:输入:1000输出:...

2019-09-07 08:34:11 342

原创 leetcode 1000. Minimum Cost to Merge Stones

There areNpiles of stones arranged in a row. Thei-th pile hasstones[i]stones.Amoveconsists of mergingexactlyKconsecutivepiles into one pile, and the cost of this move is equal to the tot...

2019-09-06 18:29:38 216

原创 leetcode 964. Least Operators to Express Number

Given a single positive integerx, we will write an expression of the formx (op1) x (op2) x (op3) x ...where each operatorop1,op2, etc. is either addition, subtraction, multiplication, or division...

2019-09-06 14:33:02 307

原创 leetcode 975. Odd Even Jump

You are given an integer arrayA. Fromsome starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...)jumps in the series are calledodd numbered jumps, and the (2nd, 4th, 6th, ...) j...

2019-09-06 10:46:35 113

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除