Solution to OJ problems