My code can be viewed in my github: Proverbs Github.
The following difficulty is defined by myself.
exclusive-time-of-functions(medium)
DFS of partitions. Be clear about the return value you defined.
flatten-nested-list-iterator(hard)
Empty nested array makes it much more complicated because you could find no value when you go into the deeper dimension and then you should go back to shallower dimension.
Another key point is that NestedInteger
and vector<NestedInteger>
can mess us up.
k-empty-slots(medium)
It is quite a typical problem of reverse thinking.
We cannot find and insert a node to a linked list in O(1) time using common thinking. However, use reverse thinking, we can do it.
multiply-strings(medium)
High-precision multiplication. Do it as how we calculate the multiplication manually.
remove-comments(easy)
Easy but should be careful to some corner cases.
remove-k-digits(medium)
It is also a typical problem using mono-increasing stack to remove digits.
Another similar problem is to output the greatest number by concatenating a set of numbers.
The solution is to compare each pair of two numbers by concatenating them in two different ways.
reorder-list(medium)
Linked list operation: split + reverse + merge.
subdomain-visit-count(easy)
Brute force with map.
text-justification(easy)
Just be careful with some corner cases.