solutions to solve common algorithm problems