摘要: 终于将LeetCode的大部分题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 博主还制作了一款 网页版APP,方便大家进行查阅,网址如下: https://grandyang.com 对应的 Github 项目 的同步地址如下, 阅读全文
posted @ 2015-06-28 23:20 Grandyang 阅读(1125806) 评论(155) 推荐(111) 编辑
摘要: You are given two strings s1 and s2 of equal length consisting of letters "x" and "y" only. Your task is to make these two strings equal to each other 阅读全文
posted @ 2021-10-23 13:04 Grandyang 阅读(15) 评论(0) 推荐(0) 编辑
摘要: If you got the following error when run the sam deploy : CREATE_FAILED AWS::Lambda::Function <YourFunctionName> Resource handler Function returned mes 阅读全文
posted @ 2021-10-21 13:06 Grandyang 阅读(15) 评论(0) 推荐(0) 编辑
摘要: Given a rectangle of size n x m, return the minimum number of integer-sided squares that tile the rectangle. Example 1: Input: n = 2, m = 3 Output: 3 阅读全文
posted @ 2021-10-20 13:31 Grandyang 阅读(6) 评论(0) 推荐(0) 编辑
摘要: You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the maximu 阅读全文
posted @ 2021-10-17 11:36 Grandyang 阅读(17) 评论(0) 推荐(0) 编辑
摘要: If you got the following warning: The elevation provided <Paper elevation={24}> is not available in the theme. Please make sure that `theme.shadows[24 阅读全文
posted @ 2021-10-14 22:51 Grandyang 阅读(9) 评论(0) 推荐(0) 编辑
摘要: Given 2 integers n and start. Your task is return any permutation p of (0,1,2.....,2^n -1) such that : p[0] = start p[i] and p[i+1] differ by only one 阅读全文
posted @ 2021-10-14 10:18 Grandyang 阅读(12) 评论(0) 推荐(0) 编辑
摘要: Given a callable function f(x, y) with a hidden formula and a value z, reverse engineer the formula and return *all positive integer pairs x and y whe 阅读全文
posted @ 2021-10-12 12:28 Grandyang 阅读(14) 评论(0) 推荐(0) 编辑
摘要: We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime,  阅读全文
posted @ 2021-10-11 02:04 Grandyang 阅读(45) 评论(0) 推荐(0) 编辑
摘要: You are given a string containing only 4 kinds of characters 'Q', 'W', 'E' and 'R'. A string is said to be balancedif each of its characters appears n 阅读全文
posted @ 2021-10-07 23:28 Grandyang 阅读(22) 评论(0) 推荐(0) 编辑
摘要: If the CodeBuild failed with following issue: Err:4 https://deb.nodesource.com/node_14.x focal Release Certificate verification failed: The certificat 阅读全文
posted @ 2021-10-07 12:55 Grandyang 阅读(70) 评论(0) 推荐(0) 编辑
摘要: Given a list of folders folder, return the folders after removing all sub-folders in those folders. You may return the answer in any order. If a folde 阅读全文
posted @ 2021-10-06 11:46 Grandyang 阅读(18) 评论(0) 推荐(0) 编辑
摘要: When you run: hexo clean && hexo g You might get the following error: err: [Error: ENFILE: file table overflow, open '/<YourFilePath>/<YourFile>'] { e 阅读全文
posted @ 2021-10-04 07:56 Grandyang 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2021-10-03 07:23 Grandyang 阅读(21) 评论(0) 推荐(0) 编辑
摘要: n passengers board an airplane with exactly n seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of pa 阅读全文
posted @ 2021-10-01 11:56 Grandyang 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Given an array nums of positive integers, return the longest possible length of an array prefix of nums, such that it is possible to remove exactly on 阅读全文
posted @ 2021-09-27 08:58 Grandyang 阅读(91) 评论(0) 推荐(0) 编辑
摘要: A die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number  阅读全文
posted @ 2021-09-23 12:21 Grandyang 阅读(76) 评论(0) 推荐(0) 编辑
摘要: When you try to debug C++ in Visual Studio Code on Mac, you might have the following error: Errors exist after running preLaunchTask 'C/C++: clang++ b 阅读全文
posted @ 2021-09-20 11:03 Grandyang 阅读(38) 评论(0) 推荐(0) 编辑
摘要: On an 8x8 chessboard, there can be multiple Black Queens and one White King. Given an array of integer coordinates queens that represents the position 阅读全文
posted @ 2021-09-17 23:53 Grandyang 阅读(63) 评论(0) 推荐(0) 编辑
摘要: Balanced strings are those that have an equal quantity of 'L' and 'R' characters. Given a balanced string s, split it in the maximum amount of balance 阅读全文
posted @ 2021-09-13 23:22 Grandyang 阅读(77) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, your task is to count how many strings of length n can be formed under the following rules: Each character is a lower case vowel ( 阅读全文
posted @ 2021-09-12 11:18 Grandyang 阅读(58) 评论(0) 推荐(0) 编辑
摘要: In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the ma 阅读全文
posted @ 2021-09-10 12:54 Grandyang 阅读(95) 评论(0) 推荐(0) 编辑
摘要: When use the VsVim plugin in Visual Studio for Mac and type the closing part of a parenthesis, you might see ClosePair(')') pop up with awkward sound. 阅读全文
posted @ 2021-09-10 09:55 Grandyang 阅读(17) 评论(1) 推荐(0) 编辑
摘要: Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that th 阅读全文
posted @ 2021-09-08 12:14 Grandyang 阅读(64) 评论(0) 推荐(0) 编辑
摘要: We have n chips, where the position of the ith chip is position[i]. We need to move all the chips to the same position. In one step, we can change the 阅读全文
posted @ 2021-09-05 02:39 Grandyang 阅读(54) 评论(0) 推荐(0) 编辑
摘要: In an n*n grid, there is a snake that spans 2 cells and starts moving from the top left corner at (0, 0) and (0, 1). The grid has empty cells represen 阅读全文
posted @ 2021-09-04 11:09 Grandyang 阅读(126) 评论(0) 推荐(0) 编辑
摘要: You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing t 阅读全文
posted @ 2021-08-31 23:51 Grandyang 阅读(91) 评论(0) 推荐(0) 编辑
摘要: There is Client-Side Library under the Add when I right click the project on Visual Studio for Mac. So I searched on Google, and find this post LibMan 阅读全文
posted @ 2021-08-31 13:02 Grandyang 阅读(29) 评论(0) 推荐(0) 编辑
摘要: You are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of t costs |s[i] - 阅读全文
posted @ 2021-08-29 02:55 Grandyang 阅读(55) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. Exam 阅读全文
posted @ 2021-08-29 02:05 Grandyang 阅读(56) 评论(0) 推荐(0) 编辑
摘要: Design a Skiplist without using any built-in libraries. A skiplist is a data structure that takes O(log(n)) time to add, erase and search. Comparing w 阅读全文
posted @ 2021-08-28 09:09 Grandyang 阅读(67) 评论(0) 推荐(0) 编辑
摘要: There are n items each belonging to zero or one of m groups where group[i] is the group that the i-th item belongs to and it's equal to -1 if the i-th 阅读全文
posted @ 2021-08-25 23:14 Grandyang 阅读(73) 评论(0) 推荐(0) 编辑
摘要: You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string. Y 阅读全文
posted @ 2021-08-23 07:24 Grandyang 阅读(80) 评论(0) 推荐(0) 编辑
摘要: An ugly number is a positive integer that is divisible by a, b, or c. Given four integers n, a, b, and c, return the nth ugly number. Example 1: Input 阅读全文
posted @ 2021-08-22 07:18 Grandyang 阅读(72) 评论(0) 推荐(0) 编辑
摘要: Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs i 阅读全文
posted @ 2021-08-19 21:43 Grandyang 阅读(618) 评论(0) 推荐(0) 编辑
摘要: There are n servers numbered from 0 to n - 1 connected by undirected server-to-server connections forming a network where connections[i] = [ai, bi] re 阅读全文
posted @ 2021-08-19 21:10 Grandyang 阅读(235) 评论(0) 推荐(0) 编辑
摘要: Given an integer array arr and an integer k, modify the array by repeating it k times. For example, if arr = [1, 2] and k = 3 then the modified array 阅读全文
posted @ 2021-08-16 06:13 Grandyang 阅读(94) 评论(0) 推荐(0) 编辑
摘要: You are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting  阅读全文
posted @ 2021-08-15 04:48 Grandyang 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Given a string text, you want to use the characters of text to form as many instances of the word "balloon" as possible. You can use each character in 阅读全文
posted @ 2021-08-12 23:10 Grandyang 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given two integer arrays arr1 and arr2, return the minimum number of operations (possibly zero) needed to make arr1 strictly increasing. In one operat 阅读全文
posted @ 2021-08-11 12:13 Grandyang 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y 阅读全文
posted @ 2021-08-09 01:37 Grandyang 阅读(138) 评论(0) 推荐(0) 编辑
Fork me on GitHub