|
|
lc286-Walls and Gates
You are given a m x n 2D grid initialized with these three possible values.
- -1 - A wall or an obstacle.
- 0 - A gate.
- INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to represent INF as you may assume that the distance to a gate is less than 2147483647.
Fill each empty room with the distance to its nearest gate. If it is impossible to reach a gate, it should be filled with INF.
For example, given the 2D grid:
|
|
After running your function, the 2D grid should be:
|
|
|
|
lc207-Course Schedule
|
|
lc50-Pow(x, n)
注意负号的corner case,以及INT_MIN
|
|
|
|
lc162-Find Peak Element
|
|
lc98-Validate Binary Search Tree
要注意的是rely on INT_MIN的问题。
in-order:
|
|
pre-order:
|
|
lc320
Write a function to generate the generalized abbreviations of a word.
Example:
|
|
backtracking
|
|
lc359-Logger Rate Limiter
Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in the last 10 seconds.
Given a message and a timestamp (in seconds granularity), return true if the message should be printed in the given timestamp, otherwise returns false.
It is possible that several messages arrive roughly at the same time.
Example:
|
|
|
|
lc422-Valid Word Square
Given a sequence of words, check whether it forms a valid word square.
A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤ k < max(numRows, numColumns).
Note:
The number of words given is at least 1 and does not exceed 500.
Word length will be at least 1 and does not exceed 500.
Each word contains only lowercase English alphabet a-z.
我有不审题和自动脑补题意的坏习惯,一开始以为输入就是一个square..= =
|
|
lc308-Range Sum Query 2D - Mutable
这个版本太慢了,改天优化。。
以及我第一次碰到了MLE的问题,原因是update调用了sumTrees,new之后没有free,之后直接update不新建node。以后还要注意。
|
|