Recent Posts

Implement topological sort

1 minute read

Problem There are n nodes and the are labelled from 0 to n - 1. Some nodes may have directed linkage, for example, if links[i] = [ai, bi] this means ai is po...

Rotate 2D square array

1 minute read

Problem Rotate 2D n by n array to 90 degree clockwise and 90 degree anti-clockwise in-place.

About const

1 minute read

I sometimes fucked up with const in the past. It is better for me to summarize these fucking things.

How to write a thread pool

2 minute read

Clarification a. We can specify number of threads in the pool b. We can enqueue tasks (For simplicity, task takes no argument and returns an integer) into th...