Solutions of common algorithm questions