How to get 2 Passport Photos for $0.09

You can go down to your local Walgreens or CVS store and print your passport photos there. It will cost you over $10 for 2 lousy passport photos.

Here’s what to do instead

Read more   2018/11/7 posted in  Life Tips

Private VPN on Raspberry Pi

The tiny, inexpensive Raspberry Pi has a very low power consumption, which makes it a great always-on VPN (Virtual Private Network) server. With a VPN, you'll get secure access to your home network when you're on the go or on public networks.

Read more   2018/9/28 posted in  Raspberry Pi

Kth Largest Element in an Array

3-way partition quickselect quicksort kth smallest

Find the kth largest element in an unsorted array.

Read more   2018/9/16 posted in  Algorithm

Move Semantics in Modern C++

C++11: rvalue, rvalue reference, std::move, std::forward

Move semantics allows an object, under certain conditions, to take ownership of other object's external (heap) resources. This helps turning expensive copies into cheap moves.

Read more   2018/9/15 posted in  C++

Smart Pointers in Modern C++

C++11: auto_ptr, unique_ptr, shared_ptr, weak_ptr

Smart pointers can do virtually everything raw pointers can, but with far fewer opportunities for error.

Read more   2018/9/14 posted in  C++

Task Scheduler

heap priority queue

Given a letter (A to Z) array representing tasks. Each task could be done in one interval. For each interval, CPU could finish one task or just be idle.

However, there is a non-negative cooling interval n that means between two same tasks, there must be at least n intervals that CPU are doing different tasks or just be idle.

You need to return the least number of intervals the CPU will take to finish all the given tasks.

Read more   2018/9/12 posted in  Algorithm

Evaluate Reverse Polish Notation


Evaluate the value of an arithmetic expression in Reverse Polish Notation.

Valid operators are +, -, *, /. Each operand may be an integer or another expression.

Read more   2018/9/12 posted in  Algorithm