688. Knight Probability in Chessboard

Problem description:

On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed, so the top-left square is (0, 0), and the bottom-right square is (N-1, N-1).

Readmore

unique paths

Problem description:

Solution:

time complexity: $O()$
space complexity: $O()$
reference:

Readmore

685. Redundant Connection II

Problem description:

In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has no parents.

Readmore

find max sibling layer

Problem description:

Solution:

time complexity: $O()$
space complexity: $O()$
reference:

Readmore

pair bike and pedestrian

Problem description:

In 2D space, m people, n bikes, with the following conditions

Readmore

log start

Problem description:

log timestamp. implement start(id, timestamp), end(id, timestamp), print the log in ascending time order.

Readmore

note Union Find

Problem description:

Union find is frequently used in graph problem. Pretty useful in cycle detection.

Readmore

803. Bricks Falling When Hit

Problem description:

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.

Readmore

951. Flip Equivalent Binary Trees

Problem description:

For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.

Readmore

777. Swap Adjacent in LR String

Problem description:

In a string composed of ‘L’, ‘R’, and ‘X’ characters, like “RXXLRXRXL”, a move consists of either replacing one occurrence of “XL” with “LX”, or replacing one occurrence of “RX” with “XR”. Given the starting string start and the ending string end, return True if and only if there exists a sequence of moves to transform one string to the other.

Readmore