0 票

# [LeetCode]Multiply Strings

0 票

Classical problem, try to finish it within 10 mins... // Coding 10 mins, debugging 5mins!!! It took me nearly 15 mins to solve it, time is so cruel...

# [LeetCode]Find Peak Element

0 票

For a random index $m$, compare $nums[m]$ with its neighbor, one of the answer belongs to the interval that the bigger element belongs to too, and we can optimize our program based on this.

Comments Off on [LeetCode]Find Peak Element

## 17 August, 2015

0 票

Notice the result($one-digit$ number) of the numbers is a periodic sequence...

# [LeetCode]Binary Tree Paths

0 票

Depth-First-Search..

#
Comments Off on [LeetCode]Binary Tree Paths

# [LeetCode]Search a 2D Matrix II

0 票

Here is a direct solution: keep narrowing the scope of matrix, and at the end, either the target doesn't belong to the matrix or the target appears in the scope's right-up corner as well as left-down corner.

Comments Off on [LeetCode]Search a 2D Matrix II

0 票

Count numbers...

# [LeetCode]Sliding Window Maximum

1 票

The data structure we selected in this problem should satisfy at least two conditions: 1) monotonicity, which guarantees in every sliding window we could always get the max element; 2) FIFO, which ensures the problem could be solved in linear time.

Comments Off on [LeetCode]Sliding Window Maximum

# [LeetCode]Product of Array Except Self

0 票

For an $n-element$ array, if we could get $\prod_{i = 0}^{k - 1}$ and $\prod_{i = k + 1}^{n - 1}$, we get $res[k]$. And here are exactly two arrays 🙂

Comments Off on [LeetCode]Product of Array Except Self

# [LeetCode]Count Complete Tree Nodes

0 票

Suppose there is a tree $Root$, now starting from $Root's$ root node, if the distance to $Root's$ left-most child node equals to the distance to the right-most child node, we can calculate the total number of tree nodes of $Root$ directly. Since we don't have to scan every node of the tree, the time complexity of algorithm is $O(h^2)$.

#
Comments Off on [LeetCode]Count Complete Tree Nodes