*博客头图：

RGB颜色，例如：#AFAFAF

Hover：

RGB颜色，例如：#AFAFAF

RGB颜色，例如：#AFAFAF

# taoqick的专栏

• 博客(663)
• 资源 (1)
• 论坛 (1)
• 收藏
• 关注

#### 原创 LeetCode 871. Minimum Number of Refueling Stops 动态规划类似背包 贪心

A car travels from a starting position to a destination which istargetmiles east of the starting position.Along the way, there are gas stations. Eachstation[i]represents a gas station that isstation[i][0]miles east of the starting position, and ha...

2020-11-29 16:27:22 5

#### 原创 python2 存csv和中文处理 [Debug]

2020-11-17 14:35:52 10

#### 原创 LeetCode 174. Dungeon Game 逆序动态规划

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 2D grid. Our valiant knight (K) was initially positioned in the top-left room and must fight his way thro

2020-11-15 23:49:29 15

1，包含a和b： ^(?=.*a)(?=.*b).*$2，包含a不包含b： ^((?!b.)*a((?!b).)*$ 例:包含admin且不包含abc。 ^((?!abc).)*admin((?!abc).)*$3，包含a不包含b和c： ^((?!b|c).)... 2020-11-14 17:18:57 49 #### 原创 vim 粘贴乱缩进 编辑模式粘贴 [Debug] 方法一：在命令模式下输入:set paste然后输入i，再在编辑模式下粘贴，这样不会乱锁紧方法二：vim --version | grep "clipboard"查看vim是不是支持clipboard，很多vim不支持，这条基本行不通：https://blog.csdn.net/zhangxiao93/article/details/53677764... 2020-11-10 16:04:34 11 #### 原创 LeetCode 1031. Maximum Sum of Two Non-Overlapping Subarrays滑动窗口 前缀和 Given an arrayAof non-negative integers, return the maximum sum of elements in two non-overlapping (contiguous) subarrays, which have lengthsLandM. (For clarification, theL-length subarray could occur before or after theM-length subarray.)Formall... 2020-11-03 23:28:42 69 #### 原创 LeetCode 1326. Minimum Number of Taps to Open to Water a Garden 动态规划 离散化 贪心 There is a one-dimensional garden on the x-axis. The garden starts at the point0and ends at the pointn. (i.e The length of the garden isn).There aren + 1taps locatedat points[0, 1, ..., n]in the garden.Given an integernand an integer arrayra... 2020-10-22 23:58:06 78 #### 原创 LeetCode 925. Long Pressed Name 有坑 Your friend is typing hisnameinto a keyboard. Sometimes, when typing a characterc, the key might getlong pressed, and the character will be typed 1 or more times.You examine thetypedcharacters of the keyboard. ReturnTrueif it is possible that i... 2020-10-15 22:51:50 28 #### 原创 LeetCode 1209. Remove All Adjacent Duplicates in String II 有坑 Given a strings, akduplicate removalconsists of choosingkadjacent and equal letters fromsand removingthem causing the left and the right side of the deleted substring to concatenate together.We repeatedly makekduplicate removals onsuntil we ... 2020-10-14 23:56:23 88 #### 原创 LeetCode 767. Reorganize String Python字符串 Given a stringS, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same.If possible, output any possible result. If not possible, return the empty string.Example 1:Input: S = "aab"Output: "a.. 2020-10-11 23:54:45 41 #### 原创 LeetCode 652. Find Duplicate Subtrees 递归小坑 Given therootof a binary tree, return allduplicate subtrees.For each kind of duplicate subtrees, you only need to return the root node of anyoneof them.Two trees areduplicateif they have thesame structurewith thesame node values.Example ... 2020-10-11 17:46:49 29 #### 原创 LeetCode 274. H-Index 二分 Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to thedefinition of h-index on Wikipedia: "A scientist has indexhifhof his/herNpapers haveat lea... 2020-10-11 14:49:23 19 #### 原创 LeetCode 1277. Count Square Submatrices with All Ones 二维前缀 Given am * nmatrix of ones and zeros, return how manysquaresubmatrices have all ones.Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1]]Output: 15Explanation: There are 10 squares of side 1.There are 4 squares of side 2.The... 2020-10-11 12:23:25 19 #### 原创 LeetCode 959. Regions Cut By Slashes 并查集 In a N x Ngridcomposed of 1 x 1 squares, each 1 x 1 square consists of a/,\, or blank space. These characters divide the square into contiguous regions.(Note that backslash characters are escaped, so a\is represented as"\\".)Return the number o... 2020-10-09 23:22:50 12 #### 转载 Mac和Eclipse不同版本JDK切换 [Debug] mac上最终安装目录(版本号根据情况略有不同)JDK 1.6：/Library/Java/JavaVirtualMachines/1.6.0.jdkJDK 1.7：/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdkJDK 1.8：/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk所以主要是改JAVA_HOME和PATH:export JAVA_6_HOME=`/usr/libexec/java 2020-09-30 11:35:57 32 #### 原创 LeetCode 844. Backspace String Compare 坑 Given twostringsSandT,return if they are equal when both are typed into empty text editors.#means a backspace character.Note that afterbackspacing an empty text, the text will continue empty.Example 1:Input: S = "ab#c", T = "ad#c"Output: tr... 2020-09-21 23:48:57 9 #### 原创 Python sys.path, PYTHONPATH和PATH的关系 [Debug] 简单来说，Python运行时的包会去sys.path找，而sys.path这个数组会从前到后找，优先级以此是：文件本身的路径 系统环境变量PYTHONPATH的路径 系统环境变量PATH里指定的anaconda的安装路径可以用以下脚本进行一下测试：import osimport sysprint("os.environ['PYTHONPATH']={0}".format(os.environ['PYTHONPATH']))print("os.environ['PATH']={0}".f 2020-09-08 13:48:11 38 #### 原创 ssh 免密登录 指定账户【Debug】 步骤1：# 即使本机器的用户名是b，也可以使用ssh a@IP登录IP的机器，直接ssh IP是以b的用户名登录$ ssh-keygen -t rsa -C "a"步骤2：在IP机器的~/.ssh/authorized_keys中追加刚才生成的公钥.pub（文件可能不存在，需要创建）...

2020-09-05 22:51:03 33

#### 原创 1145. Binary Tree Coloring Game 树上博弈

Two players play a turn based game on a binary tree. We are giventhe root of this binary tree, and the number of nodes nin the tree. n is odd, andeach node has a distinct value from 1 to n.Initially, the first player names a value x with 1 <= x &...

2020-08-29 13:56:08 51

#### 原创 LeetCode 729. My Calendar I 红黑树 线段树 二分查找树

Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking.Your class will have the method, book(int start, int end). Formally, this represents a booking on the half open interval [star

2020-08-26 11:58:39 55

#### 原创 LeetCode 354. Russian Doll Envelopes 最长递增子序列 Trick

You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope.What is the m

2020-08-25 15:09:42 26

#### 原创 LeetCode 375. Guess Number Higher or Lower II 扔鸡蛋变种

We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number I picked is higher or lower.However, when you guess a particular n

2020-08-21 18:09:10 27

#### 原创 LeetCode 792. Number of Matching Subsequences 桶排序

Given string S and adictionary of words words, find the number of words[i] that is a subsequence of S.Example :Input: S = "abcde"words = ["a", "bb", "acd", "ace"]Output: 3Explanation: There are three words in words that are a subsequence ofS : "..

2020-08-19 19:19:56 39

#### 原创 Cloud9 c9sdk的使用【Debug】

Cloud9是Amazon出的一款浏览器IDE方便访问linux机器。简单总结一下步骤：安装：安装过程中会依赖gcc和python2.7，需要提前装好：git clone https://github.com/c9/core.git c9sdkcd c9sdkscripts/install-sdk.sh启动：sudo node server.js -p 8080 --listen IP -a username:"password" -w /其中IP是本机的IP，p是端口，w是wo

2020-08-19 12:07:56 55

#### 原创 LeetCode 840. Magic Squares In Grid 找规律

A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.Given an gridof integers, how many 3 x 3 "magic square" subgrids are there? (Each subgrid is contiguous)...

2020-08-18 15:50:58 27

#### 原创 LeetCode 552. Student Attendance Record II 斐波拉契 log(n)

Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7.A student attendance record is a string that only contains the

2020-08-11 15:52:30 30

#### 原创 LeetCode 837. New 21 Game 滑动窗口 逆向动态规划

Alice plays the following game, loosely based on the card game "21".Alice starts with 0 points, and draws numbers while she has less than K points. During each draw, she gains an integer number of points randomly from the range [1, W], where W is an int.

2020-08-11 14:55:36 36

#### 原创 LeetCode 743. Network Delay Time Dijstrala BFS版 DFS版

There are N network nodes, labelled 1 to N.Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the target node, and w is the time it takes for a signal to travel from source to target.Now, we sen

2020-08-11 14:24:22 39

#### 原创 LeetCode 593. Valid Square 平面四点能否正方形

Given the coordinates of four points in 2D space, return whether the four points could construct a square.The coordinate (x,y) of a point is represented by an integer array with two integers.Example:Input: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0

2020-08-11 14:15:13 32

#### 原创 Mac安装windows双系统 U盘【Debug】

2020-08-04 23:17:36 49

#### 原创 LeetCode 803. Bricks Falling When Hit 时光倒流 注意标记

We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, or at least one of its (4-way) adjacent bricks will not drop.We will do some erasuressequentially. Eac..

2020-08-04 22:43:39 35

#### 原创 LeetCode 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit 双端队列 deque

Given anarray of integers nums and aninteger limit, return the size of the longest non-empty subarray such that the absolute difference between any two elements of this subarray is less than or equal tolimit.Example 1:Input: nums = [8,2,4,7], li...

2020-08-04 15:09:02 50

#### 原创 LeetCode 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold 1074. 二维前缀

Given a m x nmatrix mat and an integer threshold. Return the maximum side-length of a square with a sum less than or equal to threshold or return 0 if there is no such square.Example 1:Input: mat = [[1,1,3,2,4,3,2],[1,1,3,2,4,3,2],[1,1,3,2,4,3,2..

2020-08-02 00:00:35 47

#### 原创 LeetCode 914. X of a Kind in a Deck of Cards gcd 辗转相除 reduce

In a deck of cards, each card has an integer written on it.Return true if and only if you can chooseX >= 2 such thatit is possible to split the entire deckinto 1 or more groups of cards, where:Each group has exactly X cards. All the cards in eac...

2020-07-25 15:38:56 45

#### 原创 LeetCode 1146. Snapshot Array 二分 空

Implement a SnapshotArray that supports the following interface:SnapshotArray(int length) initializes an array-like data structure with the given length. Initially, each element equals 0.void set(index, val) sets the element at the given index to be eq.

2020-07-21 22:40:35 42

#### 原创 LeetCode 939. Minimum Area Rectangle 复杂度

Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points, with sides parallel to the x and y axes.If there isn't any rectangle, return 0.Example 1:Input: [[1,1],[1,3],[3,1],[3,3],[2,2]]Output: 4.

2020-07-20 18:59:54 42

#### 原创 LeetCode 659. Split Array into Consecutive Subsequences 贪心 坑 | 846. Hand of Straights

Given an array numssorted in ascending order, return true if and only if you can split it into 1 or more subsequences such that each subsequence consists of consecutive integersand has length at least 3.Example 1:Input: [1,2,3,3,4,5]Output: True...

2020-07-19 21:06:00 42

#### 原创 LeetCode 459. Repeated Substring Pattern KMP

Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000..

2020-07-19 11:56:19 34

#### 原创 LeetCode 862. Shortest Subarray with Sum at Least K 栈

Return the length of the shortest, non-empty, contiguoussubarray of A with sum at least K.If there is no non-empty subarray with sum at least K, return -1.Example 1:Input: A = [1], K = 1Output: 1Example 2:Input: A = [1,2], K = 4Output: -..

2020-07-18 15:10:51 53

#### 原创 LeetCode 1235. Maximum Profit in Job Scheduling DP 二分

We have n jobs, where every jobis scheduled to be done from startTime[i] to endTime[i], obtaining a profitof profit[i].You're given thestartTime,endTimeand profitarrays,you need to output the maximum profit you can take such that there are no 2 j...

2020-07-15 19:44:40 48

2014-05-29

#### taoqick的留言板

###### 空空如也

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

TA关注的人 TA的粉丝